How to detect space, underscore is invalid? It has to be one word. But not working with
[^\w \xC0-\xFF]
- if i do \w\xC0-\xFF i can detect the space
- but how do i detect the ‘underscore’ ?
Inputs are invalid: username1234 _1234 or username 1234
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.
Removing the space is easy as you already pointed out:
Removing the underscore requires knowing that
\wis the same as[0-9A-Za-z_]. So to also remove the underscore you can use this: