Hi I am trying to delete an HTML tag from a string.
The tag I am trying to delete is
<td class="gutter"> text text </td>
I tried the following but nothing worked:
String regex = "<td class=\"gutter\">([^<]*)</td>";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(htmlstring);
m.find() / m.matches()
But cant seem to find it at all… What am I doing wrong?
If you want to strip tags from HTML, use a library that does that. Don’t roll your own HTML parser.
http://code.google.com/p/owasp-java-html-sanitizer/