Intellij IDEA regex character class cannot be used within a character range

The error form intellij idea

IDEA will not make this error, and I could not find an option to disable such errors. Does anyone know how to fix a bug or disable a warning. Javascript works fine, only IDEA sees this as a problem

+7
javascript regex intellij-idea
source share
1 answer

You create a range using a hyphen (-) in the middle of your character class. You must move it to either end.

Also note that you do not need to avoid regular expression metacharacters within the character class. They lose their meaning there.

So just use:

[-\w._+%] 
+16
source share

All Articles