package com.changgou.order.service.impl; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Demo { public static void main(String[] args) { String str="aaaa"; boolean rs=isSpecialChar(str); System.out.println(rs); } public static boolean isSpecialChar(String str) { String regEx = "[ _`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\n|\r|\t"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(str); return m.find(); } }
java后端实现对含有特殊字符校验
最新推荐文章于 2024-06-30 03:49:11 发布