This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
action:Search_and_Replace [2021/10/14 04:01] peternlewis |
action:Search_and_Replace [2023/07/29 05:55] peternlewis |
||
---|---|---|---|
Line 37: | Line 37: | ||
{{:action:search-replace-example-result.png?nolink&511|}} | {{:action:search-replace-example-result.png?nolink&511|}} | ||
+ | |||
+ | Note that you can use tokens in the replace field (eg `%Variable%Whatever%`), but that when those tokens are expanded, the contents will themselves not be further expanded, so, for example you could not have a variable that contains `$1` and expect that to be replaced by a the corresponding capture group. You could use an AppleScript like this: | ||
+ | |||
+ | ```applescript | ||
+ | tell application "Keyboard Maestro Engine" | ||
+ | set src to getvariable "Source" | ||
+ | set s to getvariable "Search" | ||
+ | set r to getvariable "Replace" | ||
+ | set o to search src for s replace r with regex | ||
+ | end tell | ||
+ | ``` | ||
===== See Also ===== | ===== See Also ===== |