We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This worked for me. The starting of the Username cannot be _ and if [aA-zZ] is used, everything in between is considered a valid first character including _
Instead if [a-z][A-Z] is used, it considers only alphabetic characters as the first character in the username.
Cookie support is required to access HackerRank
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 →
String regex = "^[[a-z][A-Z]]\w{7,29}$";
This worked for me. The starting of the Username cannot be _ and if [aA-zZ] is used, everything in between is considered a valid first character including _
Instead if [a-z][A-Z] is used, it considers only alphabetic characters as the first character in the username.