$line =~ s/^\s*(.+?)\s<(.+?)>,/$1, $2/;
Michael Carmody wrote:
>
> Just fiddling with regex's because I see them in the digests everyday, and
> I though the best way to learn these is to try them.
> Currently sliding backwards down the learning curve...
>
> Just want to parse an email header containing addresses in format:
>
> >> Joe Frderick Blogss <[EMAIL PROTECTED]>,
> (repeated hundreds of times...)
>
> and I want to write a script that will give me an output of
>
> Name, [EMAIL PROTECTED]
>
> I probably don't need regexes to do this but I thought I'd try and see what
> I learn
> So I'm suing the s/// function to first match the email address with the
> following regex (snaffled of a website somewhere):
> ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$
>
> So this will match the email part, but I want it to find '<email>' and
> return 'email'.
> How does the stupid s/// function work !!! The perldoc pages keep using a
> $& to refer to and manipulate the input string but I don't know how to
> delete within the string , i.e. the <> characters.
>
> Is this so hard because I'm trying to row with a fork or what ?
>
> Michael Carmody
> MDU, Public Health Lab
> Dept. of Microbiology and Immunology
> The University of Melbourne, Parkville
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
David Wood, Web Developer<br>
[a] Clickmusic Ltd, 99c Talbot Road, London W11 2AT<br>
[t] 020 7727 7500
<br>[w] www.clickmusic.co.uk<br>
<br>"There are three types of people in the world; those who can count,
and those who can't."
<br> </html>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]