When using regular expressions in Python, is there any difference between '[^ ]*'
and '\S*'
? Don't they both mean "match zero or more non-whitespace characters"?
Asked
Active
Viewed 43 times
0

Blair Nangle
- 1,221
- 12
- 18
-
4tab/cr/lf and more are also considered whitespace by \s and \S whereas your character class only considers `" "` to match. – Alex K. Nov 05 '15 at 15:07
-
It is not hard to visit [regex101.com](http://regex101.com) and check yourself. Pattern description on the right is usually quite comprehensive. – Wiktor Stribiżew Nov 05 '15 at 15:09