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 pattern = @"(?!^[ ]{0,}$)^\S{1,}$";
  9. string input = @"
  10.  
  11. abcd
  12. ABCD1234
  13. #$%^&*()_+={}
  14. abc def
  15. ABC 123
  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. }
Success #stdin #stdout 0.06s 21048KB
stdin
Standard input is empty
stdout
'abcd' found at index 5.
'ABCD1234' found at index 10.
'#$%^&*()_+={}' found at index 19.