I need a regex which will allow only A-Z, a-z, 0-9, the _ character, and dot (.) in the input.
I tried:
[A-Za-z0-9_.]
But, it did not work. How can I fix it?
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.
From beginning until the end of the string, match one or more of these characters.
Edit:
Note that
^and$match the beginning and the end of a line. When multiline is enabled, this can mean that one line matches, but not the complete string.Use
\Afor the beginning of the string, and\zfor the end.See for example: http://msdn.microsoft.com/en-us/library/h5181w5w(v=vs.110).aspx