0

I need to write a method for username validation, and here are the restrictions:

  1. The first letter needs to be uppercase
  2. the other letters need to be lowercase
  3. the name has to consist of only 1 word
  4. no other symbols or spaces are allowed

So I need a regex to use to match string with regex. Please, help me out.

I just wrote this for now:

boolean matches= updatedName.matches( "(?<=\b[A-Z]+)[a-z]");
41686d6564
  • 15,043
  • 11
  • 32
  • 63

0 Answers0