[ACCEPTED]-Regex Matches white space but not tab (php)-whitespace
Accepted answer
As per my original comment, you can use 5 this.
Code
Note: The link contains whitespace characters: tab, newline, and 4 space. Only space is matched.
[^\S\t\n\r]
So your regex would be 3 [^\S\t\n\r]{2,}
Explanation
[^\S\t\n\r]
Match any character not present in the set.\S
Matches any non-whitespace character. Since it's a double negative it will actually match any whitespace character. Adding\t
,\n
, and\r
to the negated set ensures we exclude those specific characters as well. Basically, this regex is saying:- Match any whitespace character except
\t\n\r
- Match any whitespace character except
This principle in regex is often used with 2 word characters \w
to negate the underscore 1 _
character: [^\W_]
[ ]{2,} works normally (not sure about php) or 1 even / {2,}/
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.