一个正则表达式的问题.

阅读更多
		
		String needToMatch = "fadsfdafqewrdf
"; Pattern p = Pattern.compile("\\Q\\E.*\\Q\\E"); Matcher matcher = p.matcher(needToMatch); while(matcher.find()){ System.out.println("I found the text \"" + matcher.group() + "\" starting at index " + matcher.start() + " and ending at index " + matcher.end() + "."); }




得到的是
I found the text "fadsfdafqewrdf" starting at index 7 and ending at index 39.

其实我想解析成fadsf 和 dafqewrdf

请问这个正则表达式该怎么写呢? thanks

你可能感兴趣的:(正则表达式,SUN,Perl,.net)