Regex to match more than 2 white spaces but not new line
Solution 1:
Put the white space chars you want to match inside a character class. For example:
[ \t]{2,}
matches 2 or more spaces or tabs.
You could also do:
[^\S\r\n]{2,}
which matches any white-space char except \r
and \n
at least twice (note that the capital S
in \S
is short for [^\s]
).