In javascript I check for some characters but I want to allow underscores and slashes but I don’t know how.
alias: /^[a-z-Z0-9]{2,35}$/
How to put / and _ so it has not special meaning to Regexes.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
_has no special meaning at all in Regex.And if a character has special meaning, you can use
\to “despecialize” it.(BTW, you can use
\wwhich means[a-zA-Z0-9_], i.e./^[\w\/]{2,35}/. The\in\wturns a normal characterwto have a special meaning.)(Edit: Inside the
[…]the/will not be recognized as a delimiter so it is safe to use/^[\w/]{2,35}/. Thanks Andy E for showing this.)