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
|
471 Discussions
|
Please Login in order to post a comment
import java.util.Scanner;
public class Solution {
}
import java.util.Scanner; class UsernameValidator {
}
public class Solution { private static final Scanner scan = new Scanner(System.in);
}
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}";
`