正则表达式--反斜杠

import java.util.regex.Matcher;
import java.util.regex.Pattern;


    String s = "c:\test.txt"; 
    //String regEx = ".+[\\]{0,}.+$"; 
    String regEx = "\\";
    Pattern pat = Pattern.compile(regEx);  
    Matcher mat = pat.matcher(s);  
    while(mat.find()){
        System.out.println(mat.group());
    }
原文地址:https://www.cnblogs.com/tonggc1668/p/7451983.html