Java regex Pattern matches doesn't recognise "Escape +" -


this question has answer here:

i trying pattern ^\\+[0-9]+ match +852(2)78911, seems

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

is returning false. when tried in regexr working fine i.e. giving me match. not escaping correctly in java sense?

try regex instead: ^\\+[0-9\\(\\)]+$


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -