Method of replacing all tags in HTML text


(? i) Indicates a case mismatch. Both uppercase and lowercase are replaced
html = html.replaceAll(“(<(?i)(|)[^]*/?>)|( )|(‘)|(\”)”, “”);
(<(?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

Recommended Today

Common auxiliary classes

CountDownLatch Subtraction counter import java.util.concurrent.CountDownLatch; //Counter public class CountDownLatchDemo { public static void main(String[] args) throws InterruptedException { //The total number is 6. It can be used when the task must be performed CountDownLatch countDownLatch = new CountDownLatch(6); for (int i = 0; i < 6; i++) { new Thread(()->{ System.out.println(Thread.currentThread().getName()+” Go out”); countDownLatch.countDown(); },String.valueOf(i)).start(); […]