Search and replace for multiple text items within a variable?

You could use a dictionary for the search and replace pairs. This way, when you have new ones, just add them to the dictionary. You can also use a JSON-formated external source.

For example:

02-pty-fs8
[demo] Search and Replace from Dictionary.kmmacros (4.2 KB)

Input:

30-pty-fs8

Output:

25-pty-fs8

Not sure if it is this you are looking for.


Edit 2020-01-29:

Corrected an error in a regex.

5 Likes