嗨,我有以下代码,用于查找单词“is”,但不是在另一个字符串中时,因此单词“this”不应该返回匹配项,所以我使用 \b。但是以下代码找不到匹配项,我不知道为什么?
public static void main(String[] args) {
String a = "This island is beautiful.";
Pattern p = Pattern.compile("\bis\b");
Matcher m = p.matcher(a);
while(m.find()){
System.out.println(a.substring(m.start(), m.end()));
}
}