Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1184.Text file parser -- How to delete or copy text that match specified pattern of html tag?

User: Aaron -- 2014-03-10          << 1183  1185 >>
Hits: 3273
Type: Text file parser   
Search all Text file parser examples
Description:
I would like to either delete or copy text between two html tags. The first tag increases using 'm0', 'm1', 'm2' etc. as per the example below.  
The second tag remains the same.
Input Sample:
html text line 1 
html text line 2 
<div id='m0' class='divr'>Some text 1<div class='resource_container'><div class='RList_top3'> 
html text line 3 
<div id='m1' class='divr'>Some more text 2<div class='resource_container'><div class='RList_top3'> 
html text line 4 
<div id='m2' class='divr'>And again more text 3<div class='resource_container'><div class='RList_top3'> 
etc.
Output Sample:
Output 1: (lines deleted) 
 
html text line 1 
html text line 2 
html text line 3 
html text line 4 
etc. 
 
Output 2: (text between markers copied to file) 
 
Some text 1 
Some more text 2 
And again more text 3 
etc.
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Delete all tag like: 
<div id='m*'...>...<div class='resource_container'><div class='RList_top3'> 
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'search' to: 
 
3. click 'replace', done. 
4. ctrl-s save to file. 
 
Copy all text inside: 
<div id='m*'...>text to be copied<div class='resource_container'><div class='RList_top3'> 
 
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'search for pattern' to: 
 
* set 'replace with pattern' to: 
 
* uncheck 'print unmatched units' option 
3. click 'replace', done. 
4. ctrl-s save to file.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Window


Similar Examples:
How to delete blocks of text containing a specified string? (64%)
How to move strings matching specified patterns? (58%)
How to replace a string that not enclosed by specific html tag? (57%)
How to extract all specified links from a html file? (56%)
How to extarct specified pattern by conditions? (55%)
How to extract text between specified start and end strings? (55%)
How to move some words from start of line to specified location in html file? (55%)
How to find out all lines that appeared specified number of times? (55%)

Check Demo of Text file parser
Keywords:
class  div  increase  inside  tags  html tag  copy text  increas  tag  two  delete all text between  save div as html file  delete tag  div tags  delete first two  replace between div  save div to file  search replace between tags