Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

400.Advanced search and replace -- How to convert the text format by user specified rules?

User: editor -- 2010-01-19
Hits: 158
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to convert the text format by user specified rules?
Input Sample:
ACCURATE-> ACCURATELY|ACCURACY|ACCURATE
ADD-> ADDDITIONAL|ADDITIONAL|ADDITIONS|ADDITION|ADDING|ADDED|ADDS|ADD
ADVERTISE-> advertisements|ADVERTISEMENT|advertisments|ADVERTISING|ADVERTISED|ADVERTISES|ADVERTISE|ADVERT|ADS|AD
AFFORD-> AFFORDABILITY|AFFORDABILIT|AFFORDABLE|AFFORDING|AFFORDED|AFFORD
Output Sample:
ignore_case=1,reg_exp=1,cross_line=1,binary_file=0

<find>\b(ACCURATELY|ACCURACY|ACCURATE)\b</find>
<replace>ACCURATE</replace>
<find>\b(ADDDITIONAL|ADDITIONAL|ADDITIONS|ADDITION|ADDING|ADDED|ADDS|ADD)\b</find>
<replace>ADD</replace>
<find>\b(advertisements|ADVERTISEMENT|advertisments|ADVERTISING|ADVERTISED|ADVERTISES|ADVERTISE|ADVERT|ADS|AD)\b</find>
<replace>ADVERTISE</replace>
<find>\b(AFFORDABILITY|AFFORDABILIT|AFFORDABLE|AFFORDING|AFFORDED|AFFORD)\b</find>
<replace>AFFORD</replace>
Answer:
Hint: You need to Download and install "Replace Pioneer" to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog:
* set "Replace Scope" to 'Line'
* in search for pattern, enter:

* in replace with pattern enter:

* click "Advanced" page, put following in "insert begin text" entry:

3. click "Replace", done!
4. ctrl-s save the file.
Download Script:  scripts/400.rst.zip

Similar Examples:
How to change text file format with user specified rules? (86%)
How to convert numbers into scientific format with specified spacing? (67%)
How to parse data from the text file and create text with  user specified format? (64%)
How to convert the text from hex to decimal in a file? (63%)
How to convert text will pig latin rules? (62%)
How to convert the text from decimal to hex in a file? (61%)
How to count the occurrance of some specified words in many files? (59%)
How to join groups of lines together in a text file according to user defined  rule? (58%)

Check Demo of Advanced search and replace