A regular expression is required which will only allow this type of nickname:

First Name (with a capital letter) _ Last Name (with a capital letter)

^(([a-zA-Z]{4,12})([_]{1})([a-zA-Z]{4,12}))$ 

I use this, but the last name can be written with a small

  • And the name is it not? - xEdelweiss

1 answer 1

Well, a very simple regular season:

 ^([AZ][az]{3,11})_([AZ][az]{3,11})$ 

2 selectors, 1st - first name, 2nd - last name. Both the name and the surname must begin with a capital letter, the other letters are in lower case, the underscore is also required and spaces are not allowed.

If you want to allow a full upper-case, you can bring it to the following form:

 ^([AZ][a-zA-Z]{3,11})_([AZ][a-zA-Z]{3,11})$ 

Here you can try out the regular schedule on the fly: https://regex101.com/