http://www.perlmonks.org?node_id=1035490


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.

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 !!!