<td>[email protected]&nbsp;<td>
求写一段正则能匹配出如上字符串

解决方案 »

  1.   

    td>[email protected]&nbsp;<td>[email protected]是要匹配邮箱的~
      

  2.   

    <td>[email protected]&nbsp;<td>
      

  3.   

    <td>[email protected]&nbsp;<td>
    [email protected]是要匹配邮箱的~
      

  4.   

    (?ins)<td>(?<email>([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})).+?<td>
    取email分组。
    邮箱规则匹配不是我写的,网上搜索的,不知道邮箱命名规则。测试通过。你如果还有不符合的,贴出例子。
      

  5.   

    string s = @"<td>[email protected]&nbsp;<td>";
    Match m = Regex.Match(s,@"(?ins)<td>(?<email>([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})).+?<td>");
    if(m.Success)
    {
        m.Groups["email"].Value;//这个是你要的
    }
      

  6.   

    <td>&nbsp;<td>
    除了邮箱外上面是固定的,也就是说要匹配的格式可能是
    <td>[email protected]&nbsp;<td>
    <td>[email protected]&nbsp;<td>
    <td>[email protected]&nbsp;<td>
      

  7.   

    直接这样行不?
    (?ins)([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})
      

  8.   

    (?ins)<td>\W*(?<email>([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2}))&nbsp;[^<]*</td>或是这个,取分组email。
      

  9.   

    我只要取出当前string中所有的邮箱就行了 ~
      

  10.   

    嗯 匹配到了 只匹配到了 一个~~            Match m = Regex.Match(s, @"(?ins)<td>\W*(?<email>([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2}))&nbsp;[^<]*</td>
    ");
                if (m.Success)
                {
                   MessageBox.Show(m.Groups["email"].Value);
                }
      

  11.   

    [email protected]邮箱验证:
    \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
      

  12.   

    ....
    你用Match当然,只进行一次匹配当然只有一个结果。MatchCollection mc = Regex.Matches(s,@"(?ins)<td>\W*(?<email>([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2}))&nbsp;[^<]*</td>");
    foreach(Match m in mc)
    {
        m.Groups["email"].Value;
    }