Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Anything that is not ',' except .... RegEx question

by eric256 (Parson)
on Feb 27, 2008 at 15:39 UTC ( [id://670661]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Anything that is not ',' except .... RegEx question
in thread Anything that is not ',' except .... RegEx question

I was greatly entertained by how you ignored every last shred of advice in this topic. You didn't even take the part about [\d|\.] not meaning what you think it means, and used it anyway.

Either way i would talk to the person sending you this CSV since its not a legal CSV if they are putting data with commas in it without quoting those fields.

BTW you can store repeated elements of your regex in a named variable. Like:

my $num = qr/[\d.]+/; if ($line = m/^([^,]+),([^,]+),$num,$num,$num,$num,,$num,$num,$num,$nu +m,,$num,$num,$num,$num/) {

That way if you want to update that pattern you can update it just once.


___________
Eric Hodges

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-19 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found