The Regular expression
/[\D\S]/
should match characters Which is not a digit or not whitespace
But When I test this expression in regexpal
It starts matching any character that's digit, whitespace
What i am doing wrong ?
\D
= all characters except digits,
\S
= all characters except whitespaces
[\D\S]
= union (set theory) of the above character groups = all characters.
Why? Because \D
contains \s
and \S
contains \d
.
If you want to match characters which are not dights nor whitespaces you can use [^\d\s]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With