1

Given this regexp:

@([a-z0-9_-]{3,})

I don't want it to match if the pattern is "SpecialUsername".

@Tom = match
@SpecialUsername = no match
@Another = match
etc

How do I modify it for this special case?

Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
  • If your blacklist is only the one name, I wouldn't modify the regex. Just do a separate check, if possible. – aebabis Mar 11 '14 at 18:51
  • 1
    possible duplicate of [javascript regular expression to not match a word](http://stackoverflow.com/questions/6449131/javascript-regular-expression-to-not-match-a-word) – La-comadreja Mar 11 '14 at 18:51
  • 1
    possible duplicate of [Regex with exception of particular words](http://stackoverflow.com/questions/1826059/regex-with-exception-of-particular-words) – mayabelle Mar 11 '14 at 18:56

1 Answers1

2
(?!SpecialUsername)([a-z0-9_-]{3,})
La-comadreja
  • 5,627
  • 11
  • 36
  • 64
  • so it should probably be something like `@(?!SpecialUsername)([a-zA-Z0-9_-]{3,})` ? – melc Mar 11 '14 at 19:07