Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1160.Advanced search and replace -- How to change all word1 inside(or outside) bracket to word2?

User: Aaron -- 2013-12-15          << 1159  1161 >>
Hits: 1097
Type: Advanced search and replace   
Search all Advanced search and replace examples
I would like to change all occurrences of a word in text lines both inside and outside brackets as follows:

1. Change all WORD1 inside brackets only to WORD2
2. Change all WORD1 outside brackets only to WORD2

Input Sample:
input txt:
aaaaaaaa WORD1 bbbbbbbb cccccc (ddddddd WORD1 eeeee etc.)
Output Sample:
output case1:
aaaaaaaa WORD2 bbbbbbbb cccccc (ddddddd WORD1 eeeee etc.)

output case2:
aaaaaaaa WORD1 bbbbbbbb cccccc (ddddddd WORD2 eeeee etc.)
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
To change all WORD1 inside bracket to WORD2:
1. ctrl-o open text file
2. ctrl-h open 'replace' dialogue
* set 'search for pattern' to:

* set 'replace with pattern' to:

3. click 'replace', done.

To change all WORD1 outside bracket to WORD2:
Same as above, except that change 'search for pattern' to:

Note: assume all brackets are appeared in pair with normal order, and no bracket is inside another pair of bracket, like (aaa(aaa)aaa)

Screenshot 1:  Replace_Window

Screenshot 2:  Replace_Window

Similar Examples:
How to randomly delete x number of lines from text inside and outside brackets? (54%)
How to capitalize all words except some stop words? (51%)
How do you clear all values outside of french/curly brackets? (50%)
How to find consecutive words with more than 4 characters after the word "a"? (48%)
How to replace everything outside brackets with lines from another file? (48%)
How to delete all the lines without ceramics in text file? (48%)
How to change each number to an increasing number starting from 8? (47%)
How to count all words that are longer the 3 characters and sort by frequency? (47%)

Check Demo of Advanced search and replace
brackets  bracket  except  aaa  inside  same  order  ass  sum  app  ctrl h replace brackets  search and replace word order  except search text  order lines text file  replace another  another file  only search text  change word