fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string[] strings = {
  9. "...somethingashisomething...",
  10. "...something2!ashi*&something... ",
  11. "... something ashi something flashing...",
  12. "...somethingflashingsomething...",
  13. "...smashingthesomething...",
  14. "...the lashings are too tight... "
  15. };
  16.  
  17. string pattern = @"(?<!(?:sm|f?l)(?=ashing))ashi";
  18. foreach (String s in strings) {
  19. if (Regex.IsMatch(s, pattern)) {
  20. Console.WriteLine("Match: {0}", s);
  21. } else {
  22. Console.WriteLine("No match: {0}", s);
  23. }
  24. }
  25. }
  26. }
Success #stdin #stdout 0.03s 134592KB
stdin
Standard input is empty
stdout
Match: ...somethingashisomething...
Match: ...something2!ashi*&something... 
Match: ... something ashi something flashing...
No match: ...somethingflashingsomething...
No match: ...smashingthesomething...
No match: ...the lashings are too tight...