using System; using System.Text.RegularExpressions;
public class MainClass { public static void Main() {
Regex p = new Regex("((an)|(in)|(on))");
MatchCollection mn = p.Matches("King, Kong Kang"); for (int i = 0; i < mn.Count; i++) {
Console.WriteLine("Found '{0}' at position {1}",mn[i].Value, mn[i].Index);
}