对于字符串值"ABCD_12"
(包括引号),我想只提取的内容和排除了双引号,即ABCD_12
。我的代码是:正则表达式 - Java的
private static void checkRegex()
{
final Pattern stringPattern = Pattern.compile("\"([a-zA-Z_0-9])+\"");
Matcher findMatches = stringPattern.matcher("\"ABC_12\"");
if (findMatches.matches())
System.out.println("Match found" + findMatches.group(0));
}
现在,我已经尝试过做findMatches.group(1);
,但只返回最后一个字符字符串中(我不明白为什么!)。
我该如何提取只留下双引号的内容?
请尝试提供具体标题问题 - 这个基本标题有几十个问题 – DNA 2012-03-05 22:24:07