例如像这样的格式我该如何通过正则表达式截取到冒号以后的内容?
姓名:比尔盖茨
性别:男
身份证:113440196003112813
个人简介:Microsoft
想要的结果:
比尔盖茨

113440196003112813

解决方案 »

  1.   

    using System;
    using System.Text.RegularExpressions;class Program
    {
      static void Main()
      {
        string input = @"姓名:比尔盖茨
    性别:男
    身份证:113440196003112813
    个人简介:Microsoft";
        Regex r = new Regex("(?<=:).*");
        foreach (Match m in r.Matches(input))
        {
          Console.WriteLine(m.Value);
        }
      }
    }
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.Xml.Linq;namespace ConsoleCSharp
    {
        class Program
        {
            static void Main(string[] args)
            {
                string str = @"姓名:比尔盖茨
    性别:男
    身份证:113440196003112813
    个人简介:Microsoft";
                Regex re = new Regex("(?<=:).*");
                MatchCollection mc = re.Matches(str);
                foreach (Match m in mc)
                {
                    Console.WriteLine(m.Value);
                }        }
        }
    }
      

  3.   

    using System;
    using System.Text.RegularExpressions;class Program
    {
      static void Main()
      {
        string input = @"
    个人简历