Java将字符串中多个指定字符替换掉


String title= "eeee\"tttttttttaaa!qqq:vvv?mmmm/rrrr\\pppp|jj*jj*";// 你要处理的String

//String regex = "(?<>\":\\|*)"; //查找开始标签的<
String regex = "[!?<>\":\\\\|*/]+";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(title);
//将字符串中所有命中的特殊字符替换为空
title = matcher.replaceAll("");
System.out.println(title);

你可能感兴趣的:(Java将字符串中多个指定字符替换掉)