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
+ 1 comment "[^\d][a-zA-Z0-9_]{8,30}" - why this answer is wrong. double slashes next to d In IntelliJ the above regex works.
+ 0 comments public static final String regularExpression = "^[a-zA-Z](\\w|_){7,29}$";
+ 0 comments Your "Valid Username Regular Expression" is incredibly helpful! It's like finding the perfect retirement plan for retiring in Thailand. This regex makes username validation a breeze, just like planning your dream retirement destination. Thanks for sharing this valuable tool!
+ 1 comment JAVA__7
class UsernameValidator { public static final String regularExpression = "[A-Za-z][A-Za-z0-9_]{7,29}"; }
+ 1 comment public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); Pattern search = Pattern.compile("[\\W]"); int count=0; int total = in.nextInt(); while(count<total){ String s= in.next(); Matcher match = search.matcher(s); if(s.length()<8 || s.length()>30 ) System.out.println("Invalid"); if(s.length()>=8 && s.length()<=30) if((Character.isUpperCase(s.charAt(0))||Character.isLowerCase(s.charAt(0))) && !match.find()) System.out.println("Valid"); else System.out.println("Invalid"); count++; } }
}
Load more conversations
Sort 425 Discussions, By:
Please Login in order to post a comment