RE: Splitting string using split()

2001-07-18 Thread Brian
Wow, you have some good problems. Only solution I was able to come up with was something like this: $s = '[EMAIL PROTECTED], "Blow, Joe" <[EMAIL PROTECTED]>,Joe Blow <[EMAIL PROTECTED]>'; while($s) { # This is to match [EMAIL PROTECTED] if($s =~ /^([\w._]+\@[\w._]+),?\s*/) { $s = $';

RE: Splitting string using split()

2001-07-18 Thread Mike Miller
Brian <[EMAIL PROTECTED]> wrote: > > I'm way rusty on my regexp's (been on vacation for a month without doing > any) but try this: > > $s =~ m/^([^,]+),\s*(\".+\>),(.+)/; > > $1 will be "[EMAIL PROTECTED]" > $2 will be '"Blow, Joe" <[EMAIL PROTECTED]>' > $3 will be "Joe Blow <[EMAIL PROTECTED]>

RE: Splitting string using split()

2001-07-17 Thread Crowder, Rod
There is a module Text::CSV_XS that handles (surprise!) CSV files, which understands quoted strings with commas. I can make it work, so it must be easy -Original Message- From: Mike Miller [mailto:[EMAIL PROTECTED]] Sent: 18 July 2001 02:47 To: [EMAIL PROTECTED] Subject: Splitting string

RE: Splitting string using split()

2001-07-17 Thread Brian
I'm way rusty on my regexp's (been on vacation for a month without doing any) but try this: $s =~ m/^([^,]+),\s*(\".+\>),(.+)/; $1 will be "[EMAIL PROTECTED]" $2 will be '"Blow, Joe" <[EMAIL PROTECTED]>' $3 will be "Joe Blow <[EMAIL PROTECTED]>" This will work as long as all the lines are in th

RE: Splitting string using split()

2001-07-17 Thread Brian
This seems like more of a job for regexp than for split. Is there any reason not to use regexp in your particular case? Brian Johnson Partner/Systems Administrator/Programmer Source1Hosting.tv, LLC (www.source1hosting.tv) Source1Results.com, LLC (www.source1results.com) I may be insane, but reme