Thangvip9x
Active member
Please utilize my codeI dont use lowercase here [ÂÁÊÉÍÔÓÚÇA-Z]
Why the system is allowing it?![]()
Please utilize my codeI dont use lowercase here [ÂÁÊÉÍÔÓÚÇA-Z]
Why the system is allowing it?![]()
Are you certain you're using exactly that regex? I just tested it (externally, i.e. not in the XF ACP) and it wasn't matching names which start with a lowercase character. If yes, can you paste an example username that it permits?So I made with more letters another version:
/^[ÂÁÊÉÍÔÓÚÇA-Z][a-zA-ZâãáêéíôõóúçÂÁÃÊÉÍÔÓÕÚÇ0-9_-]*$/
with all accent, but I don't know why, lowercase is allowed at the beginning.
Please try it
PHP:/^[ÂÁÃÊÉÍÔÓÚÇA-Z][a-zÂáãêéíôóúç0-9_-]*$/
If it works as you expect, hit like!
This code does not allow users to have capital letters in the middle of their name. That's why I tried to make a new one that would give this possibility.Please utilize my code
I am using this:Are you certain you're using exactly that regex? I just tested it (externally, i.e. not in the XF ACP) and it wasn't matching names which start with a lowercase character. If yes, can you paste an example username that it permits?
/^[ÂÁÊÉÍÔÓÚÇA-Z][a-zA-ZâãáêéíôõóúçÂÁÃÊÉÍÔÓÕÚÇ0-9_-]*$/
Yes, that's what the regex indicates.I thought the letters in the first brackets were the only ones allowed for the beginning of the name.![]()
OK I corrected my mistake and managed to both reproduce this and find a cure.But the lowercase "â", as in the image, is still allowed.
/^[ÂÁÊÉÍÔÓÚÇA-Z][a-zA-ZâãáêéíôõóúçÂÁÃÊÉÍÔÓÕÚÇ0-9_-]*$/u
Ooh! I'll try it.OK I corrected my mistake and managed to both reproduce this and find a cure.
Turns out you need to add the 'u' flag at the end of the RE, e.g./^[ÂÁÊÉÍÔÓÚÇA-Z][a-zA-ZâãáêéíôõóúçÂÁÃÊÉÍÔÓÕÚÇ0-9_-]*$/u
![]()
I useHow to guide only permits registration of usernames with the first letter capitalized for XenForo - It only allows characters from a to z, digits from 0 to 9, hyphens, and dashes.
/^[\w ]+$/
which works well and achieves the same.Author banned for piracy
We use essential cookies to make this site work, and optional cookies to enhance your experience.