Illegal character range in regex -
i getting error message regex. here message:
message: illegal character range near index 17 .[~?!@#$%^&()_-+=[]|\;:‘“<>,.?/]{8,9}.* ^
note: ^ inthe end of message below + sign.
here code:
private static final string password_pattern_special_8 = ".*[~?!@#$%^&*()_-+=[]|\\;:‘“<>,.?/]{8,9}.*";
seems working in java.
try:
1. `pattern.quote()` function 2. \q(characterlistherewithoutbracket)\e 3. escape character manually using `\` in front of character.
second option uses thing literal lies between \q..\e
.
edit
regarding second option mean can use given in this example. see special characters.
or can check if qouted pattern regex engine using similar or not:
\.\*\[~\?!@\#\$%\^&\*\(\)_-\+=\[]\|\\\\;:‘"<>,\.\?/]\{8,9}\.\*
note: pattern obtained .net regex.escape()
function.
Comments
Post a Comment