Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA regex character class may not be used inside character range

The error form intellij 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

like image 617
spy-killer Avatar asked Jul 01 '13 22:07

spy-killer


1 Answers

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.

So, just use:

[-\w._+%]
like image 90
Rohit Jain Avatar answered Oct 20 '22 07:10

Rohit Jain