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.
Valid Username Regular Expression
Valid Username Regular Expression
Sort by
recency
|
459 Discussions
|
Please Login in order to post a comment
short and enough public static final String regularExpression = "[a-zA-Z][a-zA-Z0-9_]{7,29}";
this regex consits of: 1. one and only one alphabitic charachter at the begining 2. and 7 : 29 alphabitic, numeric or under score charachters.
import java.util.Scanner; class UsernameValidator { /* * Write regular expression here. */ public static final String regularExpression = ("^[a-zA-Z][a-zA-Z0-9_]{7,29}$"); }
public class Solution { private static final Scanner scan = new Scanner(System.in);
}