Why this regex:
[^\s]+
…says that this string:
“user’s extension”
isn’t exact match?
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.
The regex only matches a string that doesn’t contain any whitespace. Your matching method appears to apply the regex to the entire string, therefore it fails.
[abc]is a character class, meaning “eithera,borc“.[^abc]is the inverse of that class meaning “any character excepta,borc“.\smeans “any whitespace character”.[^\s](which can also be written as\S) means “any non-whitespace character”.+means “one or more of the preceding token.