fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string patternMatch = @"(?:\([A-Z]+\))?FS[A-Z ]*-\d(?:[^\n,()-]*\w)?";
  9. string patternReplace = @"(?<=^FS-[a-zA-Z0-9]*)[a-z]|[\p{Zs}\ta-z](?=[a-zA-Z0-9\p{Zs}\t]*$)";
  10. string input = @"Fakturasadas : (S)FSK-69/23/GFK/12hjkhjkddddd
  11. (S)FSK-69/23/GFK/ 1 2
  12. (S)FSK-69/23/GFK/12";
  13.  
  14. var strings = Regex
  15. .Matches(input, patternMatch)
  16. .Cast<Match>().Select(match => {
  17. return Regex.Replace(
  18. match.Value,
  19. patternReplace,
  20. ""
  21. );
  22. }
  23. );
  24.  
  25. foreach (var s in strings) {
  26. Console.WriteLine(s);
  27. }
  28. }
  29. }
  30.  
Success #stdin #stdout 0.07s 32232KB
stdin
Standard input is empty
stdout
(S)FSK-69/23/GFK/12
(S)FSK-69/23/GFK/12
(S)FSK-69/23/GFK/12