Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ^(.*?)s*((s*d+)s*)?$
  2.  
  3. using System;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class Example
  7. {
  8. public static void Main()
  9. {
  10. string pattern = @"^(.*?)s*((s*d+)s*)?$";
  11. string input = @"Test
  12. Test (1)
  13. Test (1) (2)
  14. Test (1) (2) (3)
  15. Test (1) (2) (3) (4)
  16. ";
  17. RegexOptions options = RegexOptions.Multiline;
  18.  
  19. foreach (Match m in Regex.Matches(input, pattern, options))
  20. {
  21. Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement