I am getting a text from the DB which contains Strings of the form
CO<sub>2</sub>
In order to recognize this I wrote the following code
String footText = "... some text containing CO<sub>2</sub>";
String co2HTML = "CO<sub>2</sub>";
Pattern pat = Pattern.compile(co2HTML);
Matcher mat = pat.matcher(footText);
final boolean hasCO2 = mat.matches();
The problem is that hasCO2 is always false although the inout text has that substring. What is wrong hete?
Thanks!
String.contains(CharSequence)?