"\"a".matches("a") returns false. What’s going on here?
\a.matches(a) returns false. What’s going on here?
Share
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
matchesmethod expects the entire string to match, not just a match to exist somewhere inside the target string.This, on the other hand, returns
true, because it lets the string contain anything before or after the match:Another way to look for a match anywhere in the string is by using
Patterndirectly: