Reputation: 363
I want to use this regex to check the strength of my password.
But it doesn't really work with this line of code, which I found on an other site. The / causes some problems. How do I have to write it for this list.
I need this list of characters in my regex:()[]{}?!$%&/=*+~,.;:<>-_
if (password.match(/([(,),[,],{,},?,!,$,%,&,/,=,*,+,~,])/))
Upvotes: 0
Views: 73
Reputation: 80639
Escape. Escape using backslash (\
).
/([()[\]{}?!$%&\/=*+~])/
^^ ^^ escaped literals
Note that ]
also needed to be escaped.
Upvotes: 1