Intellij IDEA正则表达式字符类不能在字符范围内使用 [英] Intellij IDEA regex character class may not be used inside character range

查看:464
本文介绍了Intellij IDEA正则表达式字符类不能在字符范围内使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IDEA不会允许此错误,我无法找到关闭这些错误的选项。有谁知道如何修复错误或关闭警告。 javascript工作正常只有IDEA认为这是一个问题

IDEA will not allow this error and i have not been able to find an option to turn off these kinds of errors. does anyone know how to fix the error or turn off the warning. The javascript works fine only IDEA sees this as a problem

推荐答案

您正在使用连字符创建一个范围( - )在你的角色类中。你应该把它移到任何一端。

You are creating a range by using the hyphen(-) in mid of your character class. You should move it to either end.

另外,请注意,您不需要转义字符类中的正则表达式元字符。他们在那里失去了意义。

Also, note that you don't need to escape the regex meta-characters inside the character class. They loose their meanings in there.

所以,只需使用:

[-\w._+%]

这篇关于Intellij IDEA正则表达式字符类不能在字符范围内使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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