Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1407.Regular expression replace -- How to replace a list of words with one single word?

User: Aaron -- 2017-12-08          << 1406  1408 >>
Hits: 3086
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
Script that replaces word list entries found in a text file with a single word  
for all entries. In this example the replacement word is LOCATION
Input Sample:
Wordlist: 
 
Key West 
Chesterville 
New York 
Washington 
Florida 
Mexico 
etc. 
 
Text file with sentences containing  
above words: 
 
I went for a vacation at Key West in  
Florida. 
We drove through Chesterville. 
It was a long way from New York. 
Maybe we'll go to Mexico next time.  
etc.
Output Sample:
I went for a vacation at LOCATION in  
LOCATION. 
We drove through LOCATION. 
It was a long way from LOCATION. 
Maybe we'll go to LOCATION next time. 
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 dialog 
* set 'search for pattern' to: 
 
* set 'replace with pattern' to: 
 
3. click 'replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to replace the content of XML with a list of words from text file? (67%)
How to replace a word with a list of words repeatly in a text file? (66%)
How to replace different words conditionally? (63%)
How to count the occurrence of a list of words in a text file? (63%)
How to replace the all word "test" with the first word in same line? (62%)
How to batch replace the last 5 "old" with "new" in a text file? (61%)
How to replace strings with words in a list in sequence or randomly? (60%)
How to replace a words with the previous word in the same column? (60%)

Check Demo of Regular expression replace
Keywords:
replacement  found  ies  list of words  scrip  script  key  scr  word list  examp  replace list of words with a single word  text replacement  replace a single word  ctrl h replace example  list word  replace text in single  replace example  search file with list