String s = "xxxx.js.jss";//目标字符串 String regex = "((?!\\.((css)|(html)|(js)|(json)|(xml))$).)+";//正则表达式 Pattern p = Pattern.compile(regex); Matcher m = p.matcher(s); if (m.matches()) { System.out.println("匹配"); } else { System.out.println("不匹配"); }
String s = "xxxx.js.jss";//目标字符串 String regex = "((?!\\.((css)|(html)|(js)|(json)|(xml))$).)+";//正则表达式 Pattern p = Pattern.compile(regex); Matcher m = p.matcher(s); if (m.matches()) { System.out.println("匹配"); } else { System.out.println("不匹配"); }