Reputation: 7095
I am attempting to configure a regular expression that matches anything numerical value but 1211 so it will still match variations such as 1212 121 1122, 3411, etc
I am unable to test the below at http://regexpal.com/ as it does not seem to support ?
(1(?!2)|1(?!2)|(?<!1)2|(?<!2)1|[^1211])+|[0-9]{1,4})
Am I doing it right and also where can I test it?
EDIT
Please note that I need to implement in a rewrite module/filter.
Upvotes: 1
Views: 331
Reputation: 141827
You can simplify that regex a lot:
^(?!1211)[1-9]\d{0,3}$
As for regexpal
, it's not working because your regex is invalid. You can tell right away because it as one more closing parenthesis than opening.
Upvotes: 4
Reputation: 43820
I suggest you take a simple route:
if (data != "1211"){
// your other regex here
}
you can test it using javascript, if you are familiar with it.
Upvotes: 0