Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Parse file, split

by Jim (Curate)
on May 28, 2013 at 00:37 UTC ( #1035490=note: print w/ replies, xml ) Need Help??


in reply to Parse file, split

For this text parsing task, I think you should use regular expression pattern matching instead of a simple string function like split. This way, you can be assured the year is a valid Gregorian year, the car maker is a legitimate one, etc. With pattern-based parsing, you can easily handle two-word vehicle manufacturers such as General Motors and International Harvester.


Comment on Re: Parse file, split
Re^2: Parse file, split
by JockoHelios (Scribe) on May 28, 2013 at 02:13 UTC

    Oops. Multiple-word manufacturers. My RegEx example does _not_ account for these, unless by happenstance.

    Meaning, it will work if they are all initials, like GMC was. Otherwise only the first word will go into Make.

    And it would a shame to miss a Manufacturer like Elfin Sports Cars, if there happen to be any of those in your list :)

    Dyslexics Untie !!!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2014-09-16 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (157 votes), past polls