My regex matcher is returning false, and I can't understand why. It works fine on regexr.com
Here's the code:
String test = "Calm_fit calm://listpage?pageid=fitnesstab SomeText";
Pattern pattern = Pattern.compile("/\bcalm?:\/\/\S+/gi");
Matcher matcher = pattern.matcher(test);
System.out.println("Here 1");
if (matcher.find()) {
System.out.println("Here 2 Matched: " + matcher.group(1));
}
Here 2 Matched:
is not getting printed. Control doesn't enter if
statement. I'm trying to extract the url calm://listpage?pageid=fitnesstab
from the text.
Am I missing something here ? Thanks in advance!