this question has answer here:
- java regexp match ascii characters 5 answers
i wanted code accept 7 bit ascii character set not accept 8bit characters. have tried regular expression:
user.getfirstname()).matches("[\\w\\s]+")
there java regular expressions class set. \p{ascii}
. see pattern class.
"abc".matches("\\p{ascii}+") == true; "abcŻ".matches("\\p{ascii}+") == false;
Comments
Post a Comment