Csharp/C Sharp by API/System.Text.RegularExpressions/RegexOptions
RegexOptions.IgnoreCase
<source lang="csharp"> using System; using System.Text.RegularExpressions; using System.IO; using System.Text; public class HTMLParser {
public static void Main(String[] args) { FileInfo MyFile = new FileInfo(args[0].ToString()); if (MyFile.Exists) { StreamReader sr = MyFile.OpenText(); string text = sr.ReadToEnd(); sr.Close(); string pattern = @"<a\shref\S*/a>"; MatchCollection patternMatches = Regex.Matches(text, pattern, RegexOptions.IgnoreCase); foreach (Match nextMatch in patternMatches) { Console.WriteLine(nextMatch.ToString()); } } else Console.WriteLine("The input file does not exist"); }
}
</source>
RegexOptions.Multiline
<source lang="csharp"> using System; using System.Collections.Generic; using System.Globalization; using System.Text; using System.Text.RegularExpressions; using System.Reflection; public class MainClass{
public static void Main(){ Regex r = new Regex(@"(^\d+$\n)+", RegexOptions.Multiline); Console.WriteLine(r.Match("987987\n129821").Value); }
}
</source>