public class MatchTest { private static final String REGEX = "^.*[(/) | (\\\\) | (:) | (\\*) | (\\?) | (\") | (<) | (>)].*$"; public static void main(String[] args) { String s = "aswd?qwe:f"; System.out.println(isMatches(s, REGEX)); } public static boolean isMatches(String str,String regex){ return str.matches(regex); } }
java验证是否包含特殊字符/\:*?"<>
猜你喜欢
转载自tomhat.iteye.com/blog/2268688
今日推荐
周排行