[thelist] ASP regex backreference

Sam Carter sam at iness.com
Tue Sep 30 13:39:17 CDT 2003


I have an automated server-side ASP script that receives email and examines
the bodytext for name, email and manager's email.  The syntax is something
like:

Name: John Doe
Email: MyEmail at whazzat.com
Cc: MyBoss at whazzat.com

Problem is, users will send the email without the prefix Name:, Email: and
CC: so the ASP script will receive something like

John Doe
MyEmail at whazzat.com
MyBoss at whazzat.com

The little parser I've written requires the keywords.

I could assume line 1, line 2, line 3 for the three elements,  but there are
exceptions , generally caused by extra line feeds / carriage returns, or
missing line feeds / carriage returns.

I hope Regex will come to the rescue.

I have no experience with regex backreferences.  Is there a regex string
that'll find the name, insert it into a string, then the first valid email ,
insert it into a string, then the 2nd valid email, insert it into another
string?  

Sam




More information about the thelist mailing list