1:  class Program
   2:  {
   3:      // sample invocation:  "([^a-z|A-Z|0-9])+" "9asdf(sss*df" "_"
   4:      // return:  Substitution : 9asdf_sss_df
   5:      static void Main(string[] args)
   6:      {
   7:          Regex regex = new Regex(args[0]);
   8:          Console.WriteLine(args[0]);
   9:          MatchCollection matches = regex.Matches(args[1]);
  10:          foreach (Match match in matches)
  11:          {
  12:              Console.WriteLine("Match: " + match.Value);
  13:              foreach (Group group in match.Groups)
  14:              {
  15:                  Console.WriteLine(String.Format("  Group (success = {0}): {1}", group.Success, group.Value));
  16:                  foreach (Capture capture in group.Captures)
  17:                  {
  18:                      Console.WriteLine(String.Format("     Capture: {0}", capture.Value));
  19:                  }
  20:              }
  21:          }
  22:          Console.WriteLine("--- Substitution : " + regex.Replace(args[1], args[2]));
  23:      }
  24:  }

Maybe some day I’ll find the time to figure the groups and caputres out. They don’t work as in Perl or Python 🙁