Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

468.Regular expression replace -- How to replace the contents between div tags with increasing number?

User: editor -- 2010-04-05          << 467  469 >>
Hits: 517
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
How to replace the contents between div tags with increasing number? The only thing that would remain the same is the div tags, the id's and classes could change and so could the content.
Input Sample:
<div id="nav" class="whatever">Content is whatever</div>
<div id="nav" class="whatever">Content is whatever</div>
<div id="nav" class="whatever">Content is whatever</div>
<div id="nav" class="whatever">Content is whatever</div>
<div id="nav" class="whatever">Content is whatever</div>
Output Sample:
<div id="nav1" class="new">This is div number 1</div>
<div id="nav2" class="new">This is div number 2</div>
<div id="nav3" class="new">This is div number 3</div>
<div id="nav4" class="new">This is div number 4</div>
<div id="nav5" class="new">This is div number 5</div>
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open 'replace' window
* in 'search for pattern' enter:

* in 'replace with pattern' enter:

3. click 'replace', done!
4. ctrl-s save to file.
Download Script:  scripts/468.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to replace file content in multiple files with corresponding filename? (61%)
How to generate multiple line text with increasing HEX number? (59%)
How to replace a word/string with increasing sequence number in a text file? (57%)
How to replace the specified text with increasing HEX strings? (57%)
How to replace specified word with increasing binary sequence? (55%)
How to remove/delete all lines with even line number? (54%)
How to remove/delete all lines with even line number? (54%)
How to change each number to an increasing number starting from 8? (53%)

Check Demo of Regular expression replace
Keywords:
contents between div tag  class  div  contents  increasing number  tags  increasing  increas  tag  same  replace div content  change content between div  only remain  replace expression between tags  replace between div  save div to file  search replace between tags  text between tags