jeudi 28 juillet 2016

Java regex Pattern matches doesn't recognise "Escape +" [duplicate]

This question already has an answer here:

I was trying the pattern ^\\+[0-9]+ to match '+852(2)78911' but it seems that

Pattern.matches("^\\+[0-9]+", s)

is returning false. When I tried it in regexr it is working i.e. giving me a match. Am I not escaping this correctly in Java sense?

Aucun commentaire:

Enregistrer un commentaire