Reputation: 7105
I have the regular expression below however it still seems to match when it should not
^article\/article_story\.aspx(\?id\=(?!1211)[0-9]{1,4})?$
So effectively if the ID equals to 1211 it should not match and the expression is passed however if it matches say ID 1212 it performs the necesarry task however it still seems to match when the ID is indeed 1211
Upvotes: 0
Views: 69
Reputation: 301347
I don't see it matching 1211 : http://regexr.com?2uam7
And you are unnecessarily complicating it with a huge regex and the (!...)
. You can just match the id part ( groups ) and then see if it is not 1211. It is not necessary to do everything in regex.
Upvotes: 3