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.
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.
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.
精彩评论