I try to make a string pattern that can contain UTF-8 characters (öäå, etc) and match the following criteria in Java (1.7);
What I have at the moment that works but are missing many of the criteria.
"#\\p{javaLowerCase}+"
I don't know how to complete and add the rest of the criteria. How would a regex expression look like that can accommodate the criteria I have?
This translates into a regex in a relatively simple way:
"[#@][\\p{javaLowerCase}\\d_-]{2,14}"
This translates the "Min 3 and maximum 15 characters" inclusive of the #
or @
at the beginning. If these should not be counted, change the suffix to {3,15}
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.