我有以下代码:
String example = "<!--§FILES_SECTION§\n" +
"Example line one\n" +
"Example line two\n" +
"§FILES_SECTION§-->";
String myPattern = ".*?FILES_SECTION.*?\n(.*?)\n.*?FILES_SECTION.*?";
Pattern p = Pattern.compile(myPattern);
Matcher m = p.matcher(example);
if ( m.matches() )
Log.d("Matcher", "PATTERN MATCHES!");
else
Log.d("MATCHER", "PATTERN DOES NOT MATCH!");
为什么它总是返回“PATTERN DOES NOT MATCH”?