User: Renlin -- 2008-07-13 << 221 223 >> |
Hits: 3627 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
how to express with if? on multi-files, search for pattern is aaa.*?bbb|ccc.*?ddd (multi-lines), and "print unmatched units" is unchecked, Replac with pattern is $match. I want if text matches pattern, then return $match, else return all the original text. so how to express this with if? |
Input Sample: |
a.txt 12323 .... dk kdf .... b.txt 959 ... aaa ... xxx xxx ... bbb ... 38438 c.txt 957eii ... ccc ... xxx xxx .... ddd ... 215 jhj 4555555 |
Output Sample: |
a.txt 12323 .... dk kdf .... b.txt aaa ... xxx xxx ... bbb c.txt ccc ... xxx xxx .... ddd |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
Sometimes 'Search for Pattern' can not handle some complicate situations, so we designed "IF" filter. If "IF" return 'True', the corresponding replace will happen, otherwise the replace will not happen. In one sentence, if can only decide "replace or not", can not decide "replace with this or that". Steps to resolve your issue: 1. ctrl-o open your file 2. ctrl-h open 'Replace' dialog * in 'Replace' page: set 'Search for pattern' to set 'Replace with pattern' to * select 'Advanced' page: set 'Run following for each matched unit' to: 3. Click 'Replace', done! |
Download Script: scripts/222.rst.zip |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |