Reputation: 6042
^[A-Za-z0-9_-]{5,20}$
and
(?i)^(?!.*?(admin|manager)).*$
So the result would be alpha-numeric string with possible underscore or/and hyphen
and following two strings would not be allowed: "admin" "manager" regardless of string position and lettercase
In isolation I understand both, but find it challenging even to start merging them together.
Input:___________ Output:
adminz5 _________ no match(admin is disallowed)
hello12- _________ match
helloaDminz5-_____no match(admin is disallowed)
Upvotes: 0
Views: 28
Reputation: 33918
You could just replace the .*
with the pattern you want (adjusted for (?i)
), like so:
(?i)^(?!.*?(admin|manager))[a-z0-9_-]{5,20}$
Upvotes: 1