Reputation: 779
I have a regex expression to match atleast one special character, one digit, an uppercase character and a lowercase character
^.*(?=.*[\W]).*$
But the above expression is excluding _ (underscore). I did a workaround by using
^.*(?=.*[\W_]).*$
But I'm not sure which all other special characters this regex expression will exclude. Also please let me know why is [\W] excluding underscores?. Any ideas?
I'm using this expression in vb.net
Upvotes: 0
Views: 1812
Reputation: 191749
\w
is letters, digits, and underscores. Thus, nothing else is being excluded. This may depend on the language/regex flavor, but it's pretty much the standard.
Upvotes: 2