jas999 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, i'm trying to parse lines from a file that have several email addresses in them, and then print them on separate lines.
Im using the following reg ex to find the lines that have an email address.($line =~ /[ |\t|\r|\n]*\"?([^\"]+\"?@[^ <>\t]+\.[^ <>\t][^ <>\t]+)[ | +\t|\r|\n]*/ )
This finds the lines but am having difficuly splitting the line if it has more than one email address.
Input:I'd like the output to be:$line = “TO: jas@jas1.com; 1@example.co.uk, random text jas@jas2.com ;
jas@jas1.com<new line> 1@example.co.uk<new line> jas@jas2.com<new line>
Could you point me in right direction?
Regards,Jas
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regular expression query
by ccn (Vicar) on Dec 27, 2008 at 21:45 UTC |