We're using JEMH, to intercept e-mails from users and extracting data from the e-mail to fill-in certain fields.
One of the things we've configured in JEMH is a script mapping rule, where we want to extract a certain part from an email and map this via Velocity into a custom field, which uses Insight data.
Example: From = role@vessel.domain.name
- role@: this changes, and must be ignored
- vessel: this is the part we want to extract
- domain.name: this never changes, and must be ignored
So in the end we want vessel to remain as a value, so it can be mapped in the insight custom field.
A nice approach would be using regex, but we lack the java expertise to nail this one.
#set($regex = "")
#foreach ($from in $message.getHeader("From"))
$from.replace($regex, "")
#end