In this HackerRank Valid Username Regular Expression problem, you need to write a regular expression to validate a username of persons. the username should consist of 8 to 30 characters inclusive. and only contain the alphanumeric characters and underscores. and the first character of the username must be an alphabetic character.

HackerRank Valid Username Regular Expression in java problem solution

HackerRank Valid Username Regular Expression in java problem solution

class UsernameValidator {
    /*
     * Write regular expression here.
     */
    public static final String regularExpression = "^[a-zA-Z][a-zA-Z0-9_]{7,29}$";
}