Home > Web Front-end > HTML Tutorial > Method to replace all tags in html text_HTML/Xhtml_web page production

Method to replace all tags in html text_HTML/Xhtml_web page production

WBOY
Release: 2016-05-16 16:41:06
Original
1745 people have browsed it

(?i) means no matching case. Regardless of uppercase or lowercase, replace
html = html.replaceAll("(<(?i)(|)[^]*/?>)|( )|(') |(")", "");
System.out.println(html);
(<(?i)(|)[^]*/? >)|( )|(')|(") -- Match all tags with spaces and quotation marks
If you only replace part of it, make the following modifications
(<(? i)(|)[^]*/?>) --Replace all tags
(<(?i)(p|img)[^]*/?>) --Replace p and img tags
(<(?i)a[^]*/?>) --Replace only a tag

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template