I have the string "SELECTOR('(namespace=''ar.com.osde.reintegros'' and eventname=''generacionReintegro'')')"
.
I need return the string that is between "SELECTOR("
and ")"
, the result should be: '(namespace=''ar.com.osde.reintegros'' and eventname=''generacionReintegro'')'
.
My code with the regular expression is:
public static String extractSelector(String txt){
Pattern pattern = Pattern.compile("^SELECTOR\\((.*)\\)$");
Matcher m = pattern.matcher(txt);
String s = null;
while (m.find()) {
s = m.group(1);
}
return s;
}
Where txt = "SELECTOR('(namespace=''ar.com.osde.reintegros'' and eventname=''generacionReintegro'')')"
But this always return null
. Why is that?