fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Example
  5. {
  6. public static void Main()
  7. {
  8. string pattern = @"\<A(G|H|I)\>\!([^\!]*)\!";
  9. string input = "<AI>!n!-Butyl acetate the quick brown <AI>!fox jumps! over the lazy dog!";
  10. string replacement = "$2";
  11. Regex rgx = new Regex(pattern);
  12. string result = rgx.Replace(input, replacement);
  13.  
  14. Console.WriteLine("Original String: '{0}'", input);
  15. Console.WriteLine("Replacement String: '{0}'", result);
  16. }
  17. }
Success #stdin #stdout 0.07s 37272KB
stdin
Standard input is empty
stdout
Original String:    '<AI>!n!-Butyl acetate the quick brown <AI>!fox jumps! over the lazy dog!'
Replacement String: 'n-Butyl acetate the quick brown fox jumps over the lazy dog!'