using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace Regular_Expression_1 { class Program { static void Main(string[] args) { Console.WriteLine(@"This will find a match for the regular expresson '[A-Z]\d'."); Console.WriteLine("Enter a test string now."); Regex myRegex = new Regex(@"[A-Z]\d", RegexOptions.IgnoreCase); string inputString = Console.ReadLine(); Match myMatch = myRegex.Match(inputString); Console.WriteLine("You entered the string '" + myMatch.ToString() + "'was found in the string you entered."); Console.ReadLine(); } } }
转载于:https://www.cnblogs.com/johnpher/archive/2011/10/20/2570611.html