@Test
    public void testRegex() throws Exception {
                String str="das:! $%#*(*(";
                String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\n|\r|\t";
                Pattern p = Pattern.compile(regEx);
                Matcher m = p.matcher(str);
                boolean isfind = m.find();
                System.err.println(isfind);
                 //regex 
                String replaceAll = str.replaceAll(regEx, "");
                 System.out.println(replaceAll);
     }

 

posted on 2020-07-21 12:06  lshan  阅读(1949)  评论(0编辑  收藏  举报