Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

511.Regular expression replace -- How to remove nested html tags that only enclose blank tags or  ?

User: editor -- 2010-05-16          << 510  512 >>
Hits: 3536
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
How to remove nested html tags that only enclose blank tags or &nbsp;?
Input Sample:
<tag1><tag2><tag3></tag3><tag3>abc</tag3></tag2><tag2><tag3>ccc</tag3><tag5><tag4><tag3>&nbsp;</tag3></tag4><tag5></tag2></tag1>...
Output Sample:
<tag1><tag2><tag3>abc</tag3></tag2><tag2><tag3>ccc</tag3></tag2></tag1>...
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text html file 
2. ctrl-h open replace window 
* set "Replace with Pattern" entry to: 
 
You can add more replace function outside depending on the maximum nest level. 
* click "Advanced" Page, fill "Run following at the beginning of Replace" to: 
 
3. click "Replace", done! 
 
Note: you can also only follow example of http://www.mind-pioneer.com/services/510_Regular_expression_replace.html 
But in "Replace window", change the "out page" to the same as "in page", so after the first time replace, you can double click the execution records to execute the same scripts multiple times, to remove the nested tags.

Similar Examples:
How to remove all html tags that enclose nothing or "&nbsp;" ? (78%)
How to remove all question mark that enclosed by title tags? (59%)
How to remove all lines whose 4th column enclosed by a pair of parenthesis? (52%)
How to batch remove all the text that enclosed by a pair of parenthesis? (52%)
How to generate an html page that include download links of specified files? (50%)
How to remove the xml tag and some duplicated tags of combined xml files? (50%)
How to remove all text that include variable strings? (50%)
How to remove all lines that contains more than one word? (50%)

Check Demo of Regular expression replace
Keywords:
remove nested html tags  how to remove nested html tags  remove nested html  scripts  level  records  maximum  aaa  cut  record  replace nested tags  html remove nested tags  remove nested tags html  remove first blank  remove html nested tags  remove nested tags  multiple scripts  remove outside