Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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
Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2015-11-30 18:09 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (778 votes), past polls