请问允许多个任意字符 是那个转义符比如 :
            模式 Exception
            匹配 SQLEception123
           这个模式 应该怎么写 我没有找到想应转义符
 

解决方案 »

  1.   

    "Exception"就是这个啊
    你有不限制开头结尾,只要被匹配的字符里有Exception存在就算
      

  2.   

    hellwindy(夜神·月) 你说能好像不对!
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;public class Zzbds
    { public static void main(String[] args)
    {
    Pattern p = Pattern.compile("Exception");
     Matcher m = p.matcher("asdfsafException");
     boolean b = m.matches();
     if(b)
     {
     System.out.println("11111");
     }
     else
     {
     System.out.println("22222222");
     }
    }}