The item referenced in this question does not seem to work for me.
I’m using the Regular Expression validator in .net
I need to pass validation if the input field does NOT look like this
“bagdfsdf -CONST”
When I use “(?>!-CONST)$” and “.*(?>!-CONST)$” the regular expression validator never allows it. If I have -CONST at the end or not
Any ideas?
(?> … )is the syntax for an atomic grouping. And the syntax for look-ahead assertion is just(?! … ).Edit Try this regular expression instead:
The
.*$will consume everything and the look-behind assertion will exclude those that end with a-CONST.Edit Just for completeness’ sake: If your regular expression language does not allow look-behinds, you can also use this one using a look-ahead assertion:
Or using just alternations: