How to replace all tags in html text

How to replace all tags in html text
(?i) means do not match case. Replace all uppercase and lowercase letters.
html = html.replaceAll("(<(?i)(|)[^]*/?>)|( )|(')|(\")", "");
System.out.println(html);
(<(?i)(|)[^]*/?>)|( )|(')|(\") -- matches all tags, spaces, and quotes. If you only want to replace a part, make the following changes
(<(?i)(|)[^]*/?>) --Replace all tags
(<(?i)(p|img)[^]*/?>) -- replace p and img tags
(<(?i)a[^]*/?>) --Replace only the a tag

<<:  How to handle spaces in CSS

>>:  Modify the style of HTML body in JS

Recommend

How to use js to communicate between two html windows

Scenario: When page A opens page B, after operati...

Why MySQL does not recommend deleting data

Table of contents Preface InnoDB storage architec...

A practical record of restoring a MySQL Slave library

Description of the situation: Today, I logged int...

Detailed explanation of the execution process of mysql update statement

There was an article about the execution process ...

Three ways to implement virtual hosts under Linux7

1. Same IP address, different port numbers Virtua...

Example operation MySQL short link

How to set up a MySQL short link 1. Check the mys...

Win10 installation Linux system tutorial diagram

To install a virtual machine on a Windows system,...

What is jQuery used for? jQuery is actually a js framework

Introduction to jQuery The jQuery library can be ...

js to implement collision detection

This article example shares the specific code of ...

Three.js realizes Facebook Metaverse 3D dynamic logo effect

Table of contents background What is the Metavers...

MySQL 8.X installation tutorial under Windows

I had been using MySQL 5.7 before, but because My...

JavaScript data flattening detailed explanation

Table of contents What is Flattening recursion to...

A comparison between the href attribute and onclick event of the a tag

First of all, let's talk about the execution ...