Regex in postmaster filter to match email address from body and set as Contact ID

Need a little help with regex to parse a email address from the body of a email and set it as ContactID The email address appears like this in the body (on its own line): Email:*Name@Domain.com I have tried this (I don't know regex I was just guessing): Email:*(.+?@.+?) I tested an email and it gave me this as a Contact ID : *name@d So I'm close. A little help please. Barry Keyles


Barry, The simple version would be, Email:\*(.*) The fancy version which accommodates a less rigid structure around the email address would be, Email:\*.*(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b) The simpler version would work on the following strings, 'Email:*email@domain.com' -> Extracts 'email@domain.com' but would fail on the following, 'Email:* some text email@domain.com some more text' The fancy version would properly parse the email address and extract the following, 'email@domain.com' Ed p.s. Note I have not tested the regexp in OTRS but it is a valid RegExp to match email addresses. On 12-Sep-07, at 8:19 PM, * ProfitGrabber Support* wrote:
Need a little help with regex to parse a email address from the body of a email and set it as ContactID
The email address appears like this in the body (on its own line):
Email:*Name@Domain.com
I have tried this (I don’t know regex I was just guessing): Email:* (.+?@.+?)
I tested an email and it gave me this as a Contact ID : *name@d
So I’m close. A little help please.
Barry Keyles
_______________________________________________ OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs Support or consulting for your OTRS system? => http://www.otrs.com/
participants (3)
-
* ProfitGrabber Support*
-
Edward Kovarski
-
pri pri