Does RegularExpressionValidator use a different flavor than Regex?

I want to do a preliminary check if the entered string looks like a vehicle identification number (VIN) . I know that it consists of 17 letters and numbers, but the letters I, O, and Q are not allowed inside the VIN, so I use this regex:

^[0-9A-Z-[IOQ]]{17}$ 

Now, if I check a string like 1G1FP22PXS2100001 with RegularExpressionValidator, it fails, but CustomValidator with this OnServerValidate event handler

Regex r = new Regex("^[0-9A-Z-[IOQ]]{17}$");
args.IsValid = r.IsMatch(TextBox1.Text);

works good.

Experiments show that RegularExpressionValidator does not support Subtraction of a character class , but the Regex class does.

Now I wonder why these two .NET classes use different regex flavors? Is this documented?

+5
2

RegularExpressionValidator JavaScript, JavaScript Regex. , , - JavaScript .NET . , , .NET -.

+5

, :

- , :

^[0-9A-HJ-NPR-Z]{17}$

, :

ASP.NET Server, , javascript -side regex validator " "

RegularExpressionValidator Class. Net:

, ( EnableClientScript false).

, . JScript.
System.Text.RegularExpressions..::.Regex.
JScript - System.Text.RegularExpressions..::.Regex.
JScript, , .

( ) RegularExpressionValidator.

+7

All Articles