I am trying to get the text inside a tag i.e. <text>. I am doing:
Pattern pattern = Pattern.compile("(?<=\\<).*(?=\\>)");
I think that this says: any character 0 or more times that before is a < (positive lookbehind) and followed by > (positive lookahead).
Matcher m = pattern.matcher(data);
if (!m.matches()) continue; //Called in a for loop
But there is no match for eg the input <text> some other stuff here.
What am I doing wrong here?
Don’t use
m.matches()butm.find().From the JavaDoc on
matches():