首页 > 代码库 > replaceAll

replaceAll

 

//        String ret = "<signature>aaa</signature>".replaceAll("[[\\s\\S]*<signature>([\\s\\S]*)</signature>[\\s\\S]*]","\"signature\":\"$1\"");
//        String ret = "<signature>aaa</signature>".replaceAll("[\\s\\S]*<signature>([\\s\\S]*)</signature>[\\s\\S]*","signature:$1,$1");
//        System.out.println(ret);
//        System.out.println("--axayazacbdbxbybz--".replaceAll("[\\s\\S]*a(\\w)b(\\w)[\\s\\S]*", "$1$2")); //bbcc
//        System.out.println("--axbycz--".replaceAll(".*a(\\w).*|.*c(\\w).*", "$1$2")); //bbcc
//        System.out.println("--<a>1</a>pp<b>2</b>pp<c>3</c>--".replaceAll(".*<a>(.*)</a>|.*<b>(.*)</b>|.*<c>(.*)</c>.*", "$1$2")); //bbcc
        System.out.println("--<a>1</a>pp<b>2</b>pp<c>3</c>yy  <list><b>4<b></list>--".replaceAll("<a>(.*)</a>|<b>(.*)</b>|<c>(.*)</c>", "$1$2$3")); //bbcc
        

 

replaceAll