当前页面: 开发资料首页 → J2SE 专题 → 正则表达式 
正则表达式 
摘要: 正则表达式  
请问允许多个任意字符 是那个转义符
比如 :
            模式 Exception
            匹配 SQLEception123
           这个模式 应该怎么写 我没有找到想应转义符 
"Exception"就是这个啊
你有不限制开头结尾,只要被匹配的字符里有Exception存在就算
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");
 }
}
}
他返回是2222
.*Exception.*
问题已经解决