Search code examples
javaregexreplaceall

REGEX in java with replaceall and on multiple line


I have a string :

0000000000<table blalba>blaalb<tr>gfdg<td>kgdfkg</td></tr>fkkkkk</table>5555

I want to replace the text between table and /table with : "", to delete this text to display only 00000000005555.

When it is on one line, it works:

chaineHtml = chaineHtml.replaceFirst("[^<title>](.*)[</title>$", "");

But the same with table fails.


Solution

  • try this

    s = s.replaceAll("<table.+/table>", "");