import java.util.regex.*; class RegexExample1{ public static void main(String args[]){ String content = "I am noob " + "from runoob.com."; String pattern = ".*runoob.*"; boolean isMatch = Pattern.matches(pattern, content); System.out.println("字符串中是否包含了 ‘runoob‘ 子字符串? " + isMatch); } }
正在更新中..........
吴裕雄--天生自然 JAVA开发学习:正则表达式