fork(6) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace RegExApplication
  5. {
  6. public class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. string input = "NNTSY";
  11. Regex regex = new Regex("(?=N[^P][ST][^P]).", RegexOptions.Compiled | RegexOptions.IgnoreCase);
  12.  
  13.  
  14.  
  15. Match match = regex.Match(input);
  16.  
  17. while (match.Success)
  18. {
  19. Console.WriteLine(input.Substring(match.Index, 4));
  20. match = match.NextMatch();
  21. }
  22. }
  23. }
  24. }
Success #stdin #stdout 0.11s 24680KB
stdin
Standard input is empty
stdout
NNTS
NTSY