jpollner
asked on
Regular Expression Help
Hi all,
I'm trying to use an application to trap and search subjects of inbound email for processing. The application (Email2DB...in case it matters or you're curious) uses "RegEx" for the string/pattern matching.
Here's an example of a subject being sent in: Testing Initiated: SiteA Mail Server
What I need to do is snag the "SiteA" component (this will change from message to message, however the outer boundaries will not...what I mean by that is the inbound message will always contain Testing Initiated:
The message will also always end with Mail Server
The variable is SiteA
I've tried a number of strings, but all I ever seem to be able to do is find the beginning of SiteA, or find everything after the :
Can anyone help me out with this?
Thanks in advance
I'm trying to use an application to trap and search subjects of inbound email for processing. The application (Email2DB...in case it matters or you're curious) uses "RegEx" for the string/pattern matching.
Here's an example of a subject being sent in: Testing Initiated: SiteA Mail Server
What I need to do is snag the "SiteA" component (this will change from message to message, however the outer boundaries will not...what I mean by that is the inbound message will always contain Testing Initiated:
The message will also always end with Mail Server
The variable is SiteA
I've tried a number of strings, but all I ever seem to be able to do is find the beginning of SiteA, or find everything after the :
Can anyone help me out with this?
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(Testing Initiated:) (.+) (Mail Server)
Matches:
$& [Testing Initiated: SiteA Mail Server]
$1 [Testing Initiated:]
$2 [ SiteA]
$3 [Mail Server]
Matches:
$& [Testing Initiated: SiteA Mail Server]
$1 [Testing Initiated:]
$2 [ SiteA]
$3 [Mail Server]
(?<=Testing Initiated:).*(?= Mail Server)