BlueLines has asked for the wisdom of the Perl Monks concerning the following question:
etc. I struggled with a regex for an hour or so, and came up with this:foo@foo.com bar@bar.com, foo@foobar.com bar@foo.com , bar@foobar.com
where $addresses contains the data POST'ed from the textarea. I feel like this should be possible without the map, but I couldn't make it work (any regex I came up with would choke on leading / trailing whitespace). Anyone care to turn this into one regex?my $addresses = $form_fields->{addresses}; my @addresses = map( $_ =~/(\S+)/, split /\b(?:\s+|(?:\s*,\s*))\b/, $ +addresses);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing data that may or may not be CSV
by gav^ (Curate) on Apr 19, 2002 at 03:10 UTC | |
|
Re: Parsing data that may or may not be CSV
by dws (Chancellor) on Apr 19, 2002 at 02:55 UTC | |
by BlueLines (Hermit) on Apr 19, 2002 at 18:19 UTC | |
|
Re: Parsing data that may or may not be CSV
by Zaxo (Archbishop) on Apr 19, 2002 at 03:12 UTC | |
by BlueLines (Hermit) on Apr 19, 2002 at 18:28 UTC |