This one could help:
^[a-z]([a-z._]*[a-z])?$
When it comes to WordPress, however, you also need to use it with an appropriate hook. That would be validate_username or registration_errors. If you’re dealing with a multisite installation, it’s more likely to be wpmu_validate_user_signup.
Thanks it works.
I want to add another thing.
Allow only 1 dot or 1 underscore, to deny to user write in way : user.na_me
Try this:
^[a-z]+([._][a-z]+)?$
And take a look at some basics on regular expressions: https://www.php.net/manual/en/reference.pcre.pattern.syntax.php (yeah, I had to go through that too). It doesn’t really have anything to do with WordPress.
Works !
Thank you so much, I can’t make a deep internet research now, to makes regex it at my own.
Looked at the regex info list I tried to added at the end of regex {4,15} min/max but it works not correct.
For example it’s start to count min from 5 and not 4
On this case not possible to count whole regex chars ?
Read a little bit about quantifier, so quantifier can’t count whole groups of regex ? only some part ? And it can’t be sum in the end ?
-
This reply was modified 1 week, 6 days ago by
wildapache.