admin管理员组文章数量:1391981
This was just working a day ago but now throwing exception. I've pasted regex into online verifier and it looks good?
What am I missing?
<input type="text" class="form-control" name="nickname" id="nickname" value="Alicia"
pattern="[\w\s\-\(\)\!\,\.]{3,45}">
Pattern attribute value
[\w\s\-\(\)\!\,\.]{3,45}
is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression:/[\w\s\-\(\)\!\,\.]{3,45}/
: Invalid escape
Thanks for the help!
Casey
This was just working a day ago but now throwing exception. I've pasted regex into online verifier and it looks good?
What am I missing?
<input type="text" class="form-control" name="nickname" id="nickname" value="Alicia"
pattern="[\w\s\-\(\)\!\,\.]{3,45}">
Pattern attribute value
[\w\s\-\(\)\!\,\.]{3,45}
is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression:/[\w\s\-\(\)\!\,\.]{3,45}/
: Invalid escape
Thanks for the help!
Casey
Share Improve this question edited Sep 22, 2016 at 0:15 Phil 165k25 gold badges262 silver badges267 bronze badges asked Sep 21, 2016 at 23:58 cphcph 4582 gold badges6 silver badges24 bronze badges 01 Answer
Reset to default 6Looks valid to me though Chrome does indeed plain.
In any case, you don't need to escape all those characters within a character class. You should be able to use
pattern="[\w\s()!,.-]{3,45}"
which seems to work ok for me.
本文标签: javascriptWhy isn39t this a valid regular expressionStack Overflow
版权声明:本文标题:javascript - Why isn't this a valid regular expression? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744710656a2621108.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论