很早就看了正则表达式,python啊,c++什么的都有,从来没细致学过,最近突然看到C#更强大,而且居然找到了一个《C#字符串和正则表达式参考手册.pdf》,就随便记些什么吧。程序员的老规矩,上代码,跑一遍比什么理论都强。
最简单的一个匹配程序:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace regex1
{
class Program
{
static void Main(string[] args)
{
Regex myRegEx = new Regex("ABC", RegexOptions.IgnoreCase);
Console.WriteLine(myRegEx.IsMatch("The first three letters of" + "the alphabet ar ABC"));
}
}
}
原文:http://www.cnblogs.com/luhouxiang/p/3675954.html