You are viewing a single comment's thread. Return to all comments →
public static final String regularExpression = "^[A-Za-z][A-Za-z0-9_]{7,29}$";`
"^[A-Za-z]" → first char must be a letter.
"[A-Za-z0-9_]{7,29}" → remaining chars must be alphanumeric or _, length between 7 and 29.
Total length = 1 (first char) + [7–29] = 8–30 characters.
Anchors ^...$ ensure no extra characters sneak in.
Seems like cookies are disabled on this browser, please enable them to open this website
Valid Username Regular Expression
You are viewing a single comment's thread. Return to all comments →
"^[A-Za-z]" → first char must be a letter.
"[A-Za-z0-9_]{7,29}" → remaining chars must be alphanumeric or _, length between 7 and 29.
Total length = 1 (first char) + [7–29] = 8–30 characters.
Anchors ^...$ ensure no extra characters sneak in.