我需要从字符串中提取"URPlus1_S2_3"
:
"Last one: http://abc.imp/Basic2#URPlus1_S2_3,"
在 Java 语言中使用正则表达式。
有人可以帮帮我吗?我是第一次使用正则表达式。
最佳答案
尝试
Pattern p = Pattern.compile("#([^,]*)");
Matcher m = p.matcher(myString);
if (m.find()) {
doSomethingWith(m.group(1)); // The matched substring
}
关于java - 使用正则表达式在java中提取子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4749549/