正则表达式在各种工具上都能匹配到字符串,但是在Myeclipse里就是不行

Pattern p = Pattern.compile("\"owner\":\\s+(\\{\\s+.*\\s+.*\\s+\\})");这是在eclipse里写的正则,m.find()返回false
"owner":\s.*({\s+.*\s+.*\s+})这是在RegexTester和各种在线正则上都能匹配到的表达式

String regex = "\"owner\"\\:\\s+.*\\(\\{\\s+.*\\s+.*\\s+\\}\\)";
String input = "\"owner\": dd({ d dfd })";
Pattern p = Pattern.compile(regex);
Matcher matcher = p.matcher (input);
while (matcher.find ())
{
System.out.println (matcher.group ());
}

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答