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

Native js to realize the upload picture control

This article example shares the specific code of ...

NULL and Empty String in Mysql

I recently came into contact with MySQL. Yesterda...

Detailed explanation of the lock structure in MySQL

Mysql supports 3 types of lock structures Table-l...

Deep understanding of line-height and vertical-align

Several concepts Line box: A box that wraps an in...

MySQL Learning: Three Paradigms for Beginners

Table of contents 1. Paradigm foundation 1.1 The ...

my.cnf (my.ini) important parameter optimization configuration instructions

MyISAM storage engine The MyISAM storage engine i...

Tutorial on installing MYSQL8.0 on Alibaba Cloud ESC

Open the connection tool. I use MobaXterm_Persona...

Solution to HTML2 canvas SVG not being recognized

There is a new feature that requires capturing a ...

Linux unlink function and how to delete files

1. unlink function For hard links, unlink is used...

Explanation of nginx load balancing and reverse proxy

Table of contents Load Balancing Load balancing c...

Markup language - for

Click here to return to the 123WORDPRESS.COM HTML ...

How to configure Nginx domain name rewriting and wildcard domain name resolution

This article introduces how to configure Nginx to...

Native JS to implement breathing carousel

Today I will share with you a breathing carousel ...