Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: CSV and regex mixups

by flounder99 (Friar)
on Jul 03, 2003 at 13:07 UTC ( [id://271148]=note: print w/replies, xml ) Need Help??


in reply to Re: CSV and regex mixups
in thread CSV and regex mixups

I felt kind of bad just giving an opinion and not a useful suggestion so here is my suggestion:
use strict; my $val = '"crosby","stills","nash","and sometimes "young""'; print join "\n", split /(?<="),(?=")/, $val; __OUTPUT__ "crosby" "stills" "nash" "and sometimes "young""
This works if you know you know your fields will always be surrounded by double quotes and there will be no spaces arround the comma. The spaces could be taken care of by using the regex /(?<=")\s*,\s*(?=")/.

--

flounder

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://271148]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found