I need to write a method for username validation, and here are the restrictions:
- The first letter needs to be uppercase
- the other letters need to be lowercase
- the name has to consist of only 1 word
- 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]");