去除除汉字字母数字小括号以外的字符
String regs="([^\\u4e00-\\u9fa5\\w\\(\\)()])+?";
Pattern pattern=Pattern.compile(regs);
String testStr="hhh(!@#$%^&*)!@#$%^&*^&*ha对数据";
Matcher matcher=pattern.matcher(testStr);
matcher.replaceAll("");
去除除汉字字母数字小括号以外的字符
String regs="([^\\u4e00-\\u9fa5\\w\\(\\)()])+?";
Pattern pattern=Pattern.compile(regs);
String testStr="hhh(!@#$%^&*)!@#$%^&*^&*ha对数据";
Matcher matcher=pattern.matcher(testStr);
matcher.replaceAll("");
本文标题:java正则表达式去除特殊字符
本文链接:https://www.haomeiwen.com/subject/jerguttx.html
网友评论