由于需要将字符串中的" ' "(单引号)替换为"/' "(斜杠加单引号),因此需要通过java的转义字符表示"/' "(斜杠加单引号)。但是发现需要表示为"' "(四个斜杠加单引号),不明白为什么。代码如下

public class testReplace {
 /**
  * @author CYH
 */
 public static void main(String[] args) {
  //替换字符串中的单引号为斜杠加单引号
String input="<p font='12'>hello</p>";
String result=new String();
result=input.replaceAll("/'","'");
System.out.println(result); 
 }
}