You are viewing a single comment's thread. Return to all comments →
Simple and Easy
public static final String regularExpression = "(^[a-zA-Z][0-9_|a-zA-Z]{7,29})";
Actually what's going here. ^ - > means the first character starting with a-z or A-Z [a-zA-Z] -> means any character in b/w a-z or A-Z Next step [0-9_|a-zA-Z] -> means any character in 0-9 _ or a-zA-Z Note ---> | this is or symbol its mean either 0-9 or a-zA-Z Like If(x%2==0 || x%5==0) now {7,29} means my character range limit why we use here 7,29 not 8,30 ? Simply first character takes first digit i.e either a-z or A-Z means for a-z or A-Z -> 1 then remainning digit is 7 so for this reason we put here 7 after putting here 7 than also we decerment 30-1 because first character already takes 1place that's why we take word limit 7,29 Hope You UnderStand :)
Valid Username Regular Expression
You are viewing a single comment's thread. Return to all comments →
Simple and Easy