Regex regex = new Regex("href\\s*=\\s*\"([^\"]*)\"", RegexOptions.IgnoreCase);
大体都明白就是  \" 不明白是什么意思 它出现了三次到底有什么作用啊。

解决方案 »

  1.   


                Regex regex1 = new Regex("href\\s*=\\s*\"([^\"]*)\"", RegexOptions.IgnoreCase);
                Regex regex2 = new Regex(@"href\s*=\s*""([^""]*)""", RegexOptions.IgnoreCase);
    这两句一样的。
      

  2.   

    正则表达式用来指定字符串模式。当你需要定位匹配某种模式的字符串时就可以使用正则表达式。如:
    import java.util.regex.*;
    class Regex1{
      public static void main(String args[]) {
             String str="For my money, the important thing "+
             "about the meeting was bridge-building";
             String regEx="a|f";   //表示a或f 
             Pattern p=Pattern.compile(regEx);
             Matcher m=p.matcher(str);
             boolean result=m.find();
             System.out.println(result);
           }
    }
           如果str匹配regEx,那么result为true,否则为flase。如果想在查找时忽略大小写,则可以写成:
    Pattern p=Pattern.compile(regEx,Pattern.CASE_INSENSITIVE);希望对你有帮助~~