Like all such requests, if you don't post the different possible inputs, then you're not going to get a complete solution.
If you have lots of different variants, then you'll need to use a search for each field.
You probably need a negative lookbehind test to avoid lines that have colons at the end. Oh, and a Possessive match qualifier.
This should work. Some notes:
- Requires 10.11+ because I was slack and used the \h horizontal space metacharacters (see this discussion).
- The search will fail, so notification and aborting needs to be turned off, and the variable needs be set to the default (empty string?) before the search.
- The regex uses a possessive match (.++) to match all the characters on the line and not backtrack from there.
- The regex uses a negative lookbehind assertion to abort if the line ends in the colon (which means none of your values can have lines that end in a colon).
- There is an initial search & replace to get rid of trailing horizontal space to ensure the colon is always the last character on the line if it is there.
- Repeat the last two actions for each key and variable.
Keyboard Maestro Actions.kmactions (2.1 KB)