SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: jporkkahtc on September 29, 2020, 07:40:42 pm

Title: Translator - muti-term search and replace
Post by: jporkkahtc on September 29, 2020, 07:40:42 pm
This macro setups a complex RE to translate between terms
 
First, create a block of text like this:
 
    abc==>def
    123==>576
 
Select those lines of text and call translateTerms().
This will populate the gui-replace dialog with a Perl RE to replace all those terms on the left with those on the right.
 
It is possible to swap terms like this:
    abc==>def
    def==>abc

All existing instances of "abc" are replaced with "def", while existing instances of "def" are replaced with "abc".