0

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

4

1 回答 1

2

\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.

于 2013-03-09T20:54:45.123 回答