分类:
正则
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Regular { class Program { static void Main(string[] args) { Regex mRegular = new Regex("a[bcd]c", RegexOptions.ExplicitCapture); //IsMatch拥有静态和非静态的几种重载方法; //如果正则表达式只使用一次,使用静态方法更好! string str = "abc acc"; Console.WriteLine(mRegular.IsMatch(str)); string str2 = "Welcome to verison-fios!"; Console.WriteLine(Regex.IsMatch(str2,"Me T",RegexOptions.IgnoreCase)); Console.ReadKey(); } } }
转载:https://blog.csdn.net/u011982340/article/details/39135931
评价