Java清除标点符号的正则表达式

[java]  view plain copy
  1. package com.test;    
  2.    
  3. public class StringTest {    
  4.      public static void main(String... args) {       
  5.            String str = "!!!??!!!!%*)%¥!KTV去符号标号!!当然。!!..**半角";       
  6.            // System.out.println(str);       
  7.             System.out.println(str.replaceAll("//p{Punct}"""));       
  8.             System.out.println(str.replaceAll("//pP"""));       
  9.            System.out.println(str.replaceAll("//p{P}"""));       
  10.           }       
  11.     
  12. }    

你可能感兴趣的:(java,正则表达式)