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
|
469 Discussions
|
Please Login in order to post a comment
public class Solution {
}}
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);
public static void main(String[] args) { int n = Integer.parseInt(scan.nextLine()); while (n-- != 0) { String userName = scan.nextLine();
} }
Just update the 'regularExpression' with the following expression:
public static final String regularExpression ="[a-zA-Z][a-zA-Z0-9_]{7,29}";
`
First Case is broken. Second line of the this case is Julia and it is not valid for these rule. but test case is giving wrong output for julia input.
why is there a compalation error to my solution? do you have it too?
class UsernameValidator { Scanner scan = new Scanner (System.in);