Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1127.Text file parser -- How to extract all text that enclosed by <a> and <font>?

User: Aaron Allan -- 2013-09-08          << 1126  1128 >>
Hits: 1190
Type: Text file parser   
Search all Text file parser examples
Description:
I am trying to make a variation of script 519. I would like to extract the color-coded text from an html file to a new text file . The html code is in the form below.

I've tried: <a.*?</font></a> but this outputs complete lines as per input.
Input Sample:
Some other text.
More text.
<a name='160' href='Text.txt.html#160'><font color='#FF0000'>text 160 to be copied </font></a>
<a name='216' href='Text.txt.html#216'><font color='#FF0000'>text 216 to be copied </font></a>
More text.
<a name='27' href='Text.txt.html#27'><font color='#FF0000'>text 27 to be copied </font></a>
More text.
<a name='89' href='Text.txt.html#89'><font color='#FF0000'>text 89 to be copied </font></a>
etc.
Output Sample:
text 160 to be copied
text 216 to be copied
text 27 to be copied
text 89 to be copied
etc.
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
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.

Screenshot 1:  Replace_Window


Similar Examples:
How to extract all text that enclosed by html tag "strong"? (80%)
How to extract all text enclosed by H1 tag from multiple html files? (65%)
How to batch remove all the text that enclosed by a pair of parenthesis? (63%)
How to extract all lines that has more than 4 columns from csv file? (60%)
How to extract all sentences that contain specified words? (59%)
How to extract all image links from a html file? (58%)
How to extract all lines that has no leading spaces? (57%)
How to extract all distinct parent folder names from a list of files? (57%)

Check Demo of Text file parser
Keywords:
font  a font  color  complete  comp  enclose  var  script  scrip  code  enclosed text search and replace  search and replace text enclosed in  replace by script  replace lines html  extract all lines from file  extract text with html  text file parser html  html file parser