未捕获的SyntaxError:无效的正则表达式 [英] Uncaught SyntaxError: Invalid regular expression

查看:844
本文介绍了未捕获的SyntaxError:无效的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



 < input id = ((<>)*;))|([<>)))testMyUtype =text 

错误:

 < $($!$)()&([<> ;.));((<>))。)*不是有效的正则表达式:未捕获的SyntaxError:无效的常规表达式:/((?!((& [^ \] *;))|([<]])。)* /:无效转义
pre>

我没有发现我的错误...

解决方案

你的问题在这里:

 < input id =testMyUtype =textrequired maxlength = 35 pattern = ((!!((& [^ \] *;))|([<]))。)*> 
^

尝试使用双反斜线。


I am trying to validate an input field using the following pattern but i get this error :

<input id="testMyU" type="text" required maxlength=35 pattern="((?!((&[^\ ]*;))|([<>])).)*" >

Error :

Pattern attribute value ((?!((&[^\ ]*;))|([<>])).)* is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /((?!((&[^\ ]*;))|([<>])).)*/: Invalid escape

I don't find my mistake ...

解决方案

Your problem is here:

<input id="testMyU" type="text" required maxlength=35 pattern="((?!((&[^\ ]*;))|([<>])).)*" >
                                                                        ^

Try using a double backslash.

这篇关于未捕获的SyntaxError:无效的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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