action:Search_and_Replace
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| action:Search_and_Replace [2017/09/08 02:44] – peternlewis | action:Search_and_Replace [2023/09/12 09:30] (current) – peternlewis | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Prior to v8.0 there were separate Search and Replace Variable and Search and Replace Clipboard actions and the results always went back to the source variable or clipboard. | Prior to v8.0 there were separate Search and Replace Variable and Search and Replace Clipboard actions and the results always went back to the source variable or clipboard. | ||
| - | {{: | + | {{: |
| You can search for: | You can search for: | ||
| Line 15: | Line 15: | ||
| Select the kind of search to run, from the //using// pop-up. Then enter the text to search for in the text area. | Select the kind of search to run, from the //using// pop-up. Then enter the text to search for in the text area. | ||
| - | Enter what to replace the found text with in the //and replace with// text area. Use the arrow at the right of the text area to select variables, clipboards and other tokens to enter in the text area. | + | Enter what to replace the found text with in the //and replace with// text area. Use the arrow at the right of the text area to select variables, clipboards and other tokens to enter in the text area. |
| + | |||
| + | For regular expressions, | ||
| + | |||
| + | Like other [[/ | ||
| Select where you want the result to be saved (back to the source, or to some other variable or clipboard or file). | Select where you want the result to be saved (back to the source, or to some other variable or clipboard or file). | ||
| + | |||
| + | Using the action (gear) ⚙ menu, you can select (v10.0+) to replace all, or only the first or last match. | ||
| Examples: | Examples: | ||
| Line 25: | Line 31: | ||
| Search for: (.+) (.+) | Search for: (.+) (.+) | ||
| Replace with: $2 $1 | Replace with: $2 $1 | ||
| - | |||
| {{: | {{: | ||
| Line 32: | Line 37: | ||
| {{: | {{: | ||
| + | |||
| + | Note that you can use tokens in the replace field (eg `%Variable%Whatever%`), | ||
| + | |||
| + | ```applescript | ||
| + | tell application " | ||
| + | set src to getvariable " | ||
| + | set s to getvariable " | ||
| + | set r to getvariable " | ||
| + | set o to search src for s replace r with regex | ||
| + | end tell | ||
| + | ``` | ||
| ===== See Also ===== | ===== See Also ===== | ||
| Line 37: | Line 53: | ||
| === Actions === | === Actions === | ||
| + | * [[action: | ||
| * [[: | * [[: | ||
action/Search_and_Replace.1504838658.txt.gz · Last modified: by peternlewis
