mercredi 7 juin 2017

What is wrong with this pattern : Pattern pattern = Pattern.compile("\\");

I just want to use the regular expression to match the backslash() character, but it throws Exception:

Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at helloworld.HelloWorld.main(HelloWorld.java:20)

Aucun commentaire:

Enregistrer un commentaire