Exclude Literal backslash in Javascript Regular Expression

I'm writing a php forms class with client and server side validation. I'm having problems checking if a literal backslash ("\") exists in a string using regular expressions in javascript. I want to shy away from solutions other than using regex as this will reduce the amount of special cases between php and js AND reduce the amount of conditional code I need to write.I've just been using this as an example of what a user may need in this forms class- \[quote\] A password field that is a string between 6 and 12 chars long and that excludes "\","#","$","`"\[/quote\]I have tried:\[code\]^[^(\u0008#\$`)]{6,12}$^[^(\b#\$`)]{6,12}$^[^(\\#\$`)]{6,12}$\[/code\]And none of them work for a backslash and I can't work out why. FYI: The latter works fine in PHP.
 
Back
Top