如何逃脱产生的“意外量词&QUOT错误正则表达式,在IE浏览器? [英] How to escape a RegEx that generates an error of “unexpected quantifier"on IE?

查看:960
本文介绍了如何逃脱产生的“意外量词&QUOT错误正则表达式,在IE浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用asp.net和C#。我有文本框用正则表达式的验证控制。

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

我用这个code作为验证。

I use this code as validation.

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

但只有在IE9我收到一个错误:意外的量词从JavaScript部分

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.

你能不能帮我code的样本?谢谢

Could you help me with a sample of code? Thanks

推荐答案

写像这样来代替:

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

我怀疑(?s)是错误的原因。

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

这篇关于如何逃脱产生的“意外量词&QUOT错误正则表达式,在IE浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆