Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape a RegEx that generates an error of “unexpected quantifier"on IE?

I use asp.net and C#. I have TextBox with an Validation Control with RegEx.

I use this code as validation.

ValidationExpression="^(?s)(.){4,128}$"

But only in IE9 I receive an error: unexpected quantifier from the javascript section.

Probably I have to escape my RegEx but I do not have any idea how to do it and what to escape.

Could you help me with a sample of code? Thanks

like image 623
GibboK Avatar asked Feb 23 '23 09:02

GibboK


1 Answers

Write it like this instead :

 ^([\s\S]){4,128}$

I suspect that (?s) is the cause of the error.

like image 131
FailedDev Avatar answered Feb 24 '23 23:02

FailedDev