User: editor -- 2010-04-05 << 467 469 >> |
Hits: 3408 |
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 the second column of a file with an increasing number? (72%) How to get content between a pair of nearest ab bc? (61%) How to replace file content in multiple files with corresponding filename? (61%) How to replace a word/string with increasing number in multiple files? (60%) 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 extract text between specified start and end strings? (56%) |
Check Demo of Regular expression replace |
Keywords: |
contents between div tag div tags class div increasing number contents increasing tags increas tag replace div content change content between div replace expression between tags replace between div only remain save div to file search replace between tags text between tags |