java - Regular expression for a string containing at least one number -


can please explain following regular expression means?

^(?=.*[\p{l}\p{m}0-9]).{6,50}$ 

it forces users have @ least 1 number in username.

how should modify remove constraint?

you need remove 0-9 constraint set in look-ahead:

^(?=.*[\p{l}\p{m}]).{6,50}$ 

now, allows string containing symbols newline, 6 50 occurrences, , @ least 1 unicode letter.

to use in java, need double-escape backslashes:

string pattern = "^(?=.*[\\p{l}\\p{m}]).{6,50}$"; 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -