被验证内容类似:
 人到中年|http://www.rdzn.com:9990其中:
1,人到中年,可以是任意非空字符
2,"|"必须有
3,http://也可以是HTTP://
4,必须以":"加数字(最少四位最多六位)结尾对正则不是很熟.自己写一个试试.
   
   (\w+)\|(http://|HTTP://)(\w+):\d{2,6}自已分数可怜,忘理解,同时给予帮助.谢谢

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Text.RegularExpressions;namespace ConsoleApplication1
    {
        class Test
        {
            static void Main()
            {
                string[] str = new string[] { @"人到中年|http://www.rdzn.com:9990", @"http://www.abc.com/12345/", @"http://www.abc.com/123454" };
                Regex re = new Regex(@"^[^\s]+\|(http|HTTP)://[^:]+:\d{4,6}$");
                foreach (string s in str)
                {
                    if (re.Match(s).Success)
                        Console.WriteLine(re.Match(s).Value);            }        }
        }
    }你忘了转义
      

  2.   

    (.*)\|((http:)|(HTTP:))\/\/(.*):\d{4,6}