我有一个类似字符串,比如:<FONT color=#3333cc>[email protected]</font>我想取出这部分内容:[email protected],应该怎么取?求救大家,谢谢了!!!

解决方案 »

  1.   

    [a-zA-Z0-9_+.-]+\\@([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9]{2,4}这这个正则
      

  2.   

    假如你要获取的是上面有规律的:
    (?<=<font[^>]*>)(?=</font>)
      

  3.   

    (?is)(?<=<font[^>]*>)(?=</font>)
      

  4.   

    可以考虑给个label装这个东西,然后去label的值
      

  5.   

    string str = "<FONT color=#3333cc>[email protected]</font>";
                str = str.Substring(str.IndexOf(">")+1, str.Length - str.IndexOf(">")-1);
                str = str.Substring(0,str.IndexOf("<"));
      

  6.   


    void Main()
    {
    string html="<FONT color=#3333cc>[email protected]</font>";
    foreach(Match m in Regex.Matches(html,"(?i)(?<=<FONT[^>]*?>)[^<>]+(?=</font>)"))
    {
    Console.WriteLine(m.Value);
    }
    //[email protected]}
      

  7.   

    hen_ai_hen_ai_ni,能不能写个完整的代码,谢谢了。
      

  8.   

    TO:q107770540,可是,不一定是<font></font> 也有可能是<a href=></a> 这种等等
      

  9.   

    v那就修改一下: foreach(Match m in Regex.Matches(html,"(?i)(?<=<[^>]*?>)[^<>]+(?=</[^>]*?>)"))
      

  10.   

    再简化一下: foreach(Match m in Regex.Matches(html,"(?<=>)[^<>]+(?=<)"))