So my forum allows me to use a regex to allow certain user names registration, but I want to do that opposite and block any non-matches, which the system doesn’t allow for inherently.
How can I not match a pattern of [a-zA-Z]+[0-9]{4}?
Meaning that it would return false for, say
FOobar1234
bar5678
I’ve tried but can’t get this to work.
Sort of how like [^a-zA-Z]+ would return false for foobar (matches a-z) but with 4 digits at the end too.
You can make use of negative lookahead assertion:
In general:
matches only those strings that do not match the regex
<pattern>.See it