Guest User

Untitled

a guest
Jul 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. a: ',,,,,,,' match
  2. b: ',,,,,,#A' no match
  3.  
  4. [^,]
  5.  
  6. if (!Regex.IsMatch(yourTestString, "[^,]"))
  7. {
  8. // This string does NOT contain commas
  9. }
  10.  
  11. var text = ",,,";
  12. Regex.IsMatch(text, @"^,+$"); // true
  13.  
  14. private void IsOnlyOneChar(string input, char c)
  15. {
  16. for (var i = 0; i < input.Length; ++i)
  17. if (input[i] != c)
  18. return false;
  19.  
  20. return true;
  21. }
  22.  
  23. Regex.IsMatch(str, @"^,*$");
Add Comment
Please, Sign In to add comment