Pulling data from Mail same line after ':' to KM as Variable?

Hi, I receive emails in Mail with the following information. I would only like to pull out the info on the same line after the ‘:’

Mail contain this following fields;
Your full name:
Telephone number:
Address Line 1:
Post Code:

e.g.
Your full name: Mr Peter Smith
Telephone number: 04564

Result I am after:
The KM variable named ‘Your full name’ would hold the string 'Mr Peter Smith’
The KM variable named ‘Telephone number’ would hold the string ‘04564’

How can I do this in KM if it is possible?

A very good starting point is the KM Wiki article about Regular Expressions. It explains the basics, gives you examples, and – if you scroll down – many very useful links, also to existing Forum topics.

Here is a basic example macro that works with your input sample:

_[example] Regex.kmmacros (3.0 KB)

2 Likes

Macro actions I am trying to achieve would really appreciate help with the first two points:

  1. If an email is received that has the following in subject ‘“Apply Now” Form - Contact form on IronStone Legal’ Execute a macro (need help really having difficulty with this part)
  2. Extract the entire content of the email into a variable (need help)
  3. Sort from that variable using regular expressions into other variables (done)
  4. Use those variables to add to the CRM (done)
  5. Execute another macro (done)

All this (except #1) can be done relatively easily via AppleScript. As an example see this thread (doesn’t do what you want, but gives you straight basics on how to access Mail via AppleScript), or search the forum with “mail AppleScript” or similar.

Concerning #1, you are asking for a trigger when a mail comes in. Not sure how to realize this in KM, but the OS provides Notifications, so maybe going that route (with or without KM).