Background:
I'm using director.js to match routes, and using regex for different parameters.
Problem:
Need to come up with a regex for a parameter which matches regex 1 while not matching regex 2 (I know it's bad design but there're various reasons which I have to do it this way)
[._a-zA-Z0-9-%!\(\)'*]+[a-z0-9][a-zA-Z0-9]{3}(0[a-zA-Z0-9]{2}|[a-zA-Z0-9]00)[a-zA-Z0-9]{8}([a-zA-Z0-9]{3})?
What's the best way of doing this?
Update:
Thanks to gyre. I think something similiar to (?![a-z0-9][a-zA-Z0-9]{3}(0[a-zA-Z0-9]{2}|[a-zA-Z0-9]00)[a-zA-Z0-9]{8}([a-zA-Z0-9]{3})?)(?:[._a-zA-Z0-9-%!()'*]+) is what I want, but it doesn't work when I tried in my application, using this regex in https://regex101.com/, it can still find a match for string "00Bxx0000025e1UEA" --> Bxx0000025e1UEA which I think the library was confused somehow. Is there anyway to update the regex to not find a match for "00Bxx0000025e1UEA" at all?
I have tried to add ^ and $ for the regex:
(?!^[a-z0-9][a-zA-Z0-9]{3}(0[a-zA-Z0-9]{2}|[a-zA-Z0-9]00)[a-zA-Z0-9]{8}([a-zA-Z0-9]{3})?$)(?:[._a-zA-Z0-9-%!()'*]+) but that's still incorrect.
^(?![a-z0-9][a-zA-Z0-9]{3}(0[a-zA-Z0-9]{2}|[a-zA-Z0-9]00)[a-zA-Z0-9]{8}([a-zA-Z0-9]{3})?)[._a-zA-Z0-9-%!()'*]+$at the end.^(?![a-z0-9][a-zA-Z0-9]{3}(0[a-zA-Z0-9]{2}|[a-zA-Z0-9]00)[a-zA-Z0-9]{8}([a-zA-Z0-9]{3})?)[._a-zA-Z0-9-%!()'*]+$this? Does't work with this string 00Bxx0000025gVvEAIddfdafdsfsf$at the end of the exclusion pattern, just after the question mark.