[^(Site)(Table)(Chair)}不行
Site,Table,Chair不能作为一个整体匹配
谢谢!

解决方案 »

  1.   

    采用间接方法吧  
        String regex = "((Site)|(Table)|(Chair))";
          String str = "iiteTableddd";
          Pattern p = Pattern.compile(regex);
          Matcher m = p.matcher(str);      boolean isFound= ;
          int start = -1;
          if(m.find()){
           start = m.start();
          }
          if(start == 0){
              System.out.println("Begin with regex");
          }else {
              System.out.println("Not Begin with regex");
          }不过有点麻烦,还不如使用String.startWith(str);这样的方法哪
      

  2.   

    直接用正则表达式写,感觉写不出来! 不如直接用String.startWith
      

  3.   

    以Site开头的字符串!
    Pattern pa = Pattern.compile("^Site.*");