PDA

View Full Version : Using wildcards - changing a part of sentence



dagerr
02-15-2019, 02:57 AM
Hi,
I'm using Find And Replace with matching wildcards and following text to be found:



\<Lead\>\{Lead:lead_red\}<*>, \{\/Lead:lead_red\}\{Body:red\}<*>► \{\/Body:red\}


Searching works correct But I want repleace only a part of searched sentence:



<Lead>{Lead:lead_red}<*>, <*>► {/Lead:lead_red}


In this case "<*>" words with brackets<> should stay unchanged.
E.g.
Find:
<Lead>{Lead:lead_red}KAMIONKA, {/Lead:lead_red}{Body:red}OCIEKA► {/Body:red}
expectetion:
<Lead>{Lead:lead_red}KAMIONKA, OCIEKA► {/Lead:lead_red}
Thanks for helping


Karol

macropod
02-15-2019, 04:33 AM
You could use a wildcard Find/Replace with:
Find = (\<*\{[!\{]@)(\{*\})\{*\}([!\{]@)\{*\}
Replace = \1\3\2

dagerr
02-15-2019, 06:00 AM
Many thanks for it, but this solution has little bug: When I'm putting cursor after searched text it cuts one of two words e.g.:


Before:
<Lead>{Lead:lead_red}KAMIONKA, {/Lead:lead_red}{Body:red}OCIEKA► {/Body:red}
After:
<Lead>{Lead:lead_red}KAMIONKA, {/Lead:lead_red}


When I'm putting cursor before searched text everything works fine.

macropod
02-15-2019, 02:01 PM
That's a fairly common limitation of Find/Replace and has nothing to do with the Find/Replace expression I posted, as such.