I am now trying to get the regular expression from the line below, I manage to copy the data I want to clipboard and it looks like this;
First name::
Clive
Middle name(s)::
George
Last name::
Bread
Mobile number::
00123457142841
The question always ends with ':' I'm trying to extract the answers to save as KM variables..
The answers are always on a single line after the question.
The yellow actions are for demonstration purposes (building the clipboard, displaying the result). You may not need them in your work context.
Based on your statement “The question always ends with ':'” I am assuming that any answer is not ending with a ‘:’. If this is not true, then use this slightly more complex regex: (?m)(?<=:[\n\r]).+$
If you prefer to work with local variables you can prefix any variable with “Local ”, “Local_” or “Local__”. (Except for variables that are intended for further use with another macro.)
Using a dictionary:
Instead of variables you can also save the answers to a dictionary. The macro then could look like this:
That way the order can change and the macro will still work.
Noted that if you want to allow for missing fields, then you need to initially set the match variable (as shown above) and also configure the Search Using Regular Expression action to not notify or fail on error.