Method of replacing all tags in HTML text

Time:2021-5-10

(? i) Indicates a case mismatch. Both uppercase and lowercase are replaced
html = html.replaceAll(“(<(?i)(|)[^]*/?>)|( )|(‘)|(\”)”, “”);
System.out.println(html);
(<(?i)(|)[^]*/?>)|( )|(‘)|(\”)  — Match all tags with spaces and quotes
If only a part is replaced, make the following modification
(<(?i)(|)[^]*/?>)–Replace all labels
(<(?i)(p|img)[^]*/?>)–Replace P and img Tags
(<(?i)a[^]*/?>)    — Replace a label only