Try this... my $data = "BlahBlahBlahBlah From: BlahsvilleDude <[EMAIL PROTECTED]>BlahBBlahBBlah" $data =~ s/^.*<([^>]*)>.*$/$1/;
Broken down... s/ = substitute ^ = beginning of string .* = anything, zero or more times < = "<" ( = start trapping text [^>]* = anything but ">", zero or more times )> = stop trapping text .* = anything, zero or more times $ = end of string /$1/ = replace matched text with the trapped text Rob -----Original Message----- From: Gregg R. Allen [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 5:25 PM To: [EMAIL PROTECTED] Cc: Gregg R. Allen Subject: Simple Regex Problem. So my boss just told me that he doesn't like the fact that the "From:" field in our email database typically looks like: "BlahBlahBlahBlah From: BlahsvilleDude <[EMAIL PROTECTED]>BlahBBlahBBlah" (The "blahs", of course, are not literal, but can be anything.) He wants the subject field to look like: "[EMAIL PROTECTED]" I know this can be done very easily with a Perl regex but I've been away from Perl for about two years and I've forgotten very much. Thanks in advance, Gregg R. Allen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]