in reply to Simple RegEx Substring Extraction from a Delimited Text Record

As always, it's great to see how a simple question can generate a lot of chatter... and is a testament to how keen we all get about good ol' Perl :)

With all the good ideas presented, it seems a re-working of my original split usage might suit me best, as I'm likely to want to refer to each of the data items by name elsewhere. The actual structure in the file is pretty convoluted (well, multiple multi-line records in many 'regions' of the same text file) but this method is likely to get me farthest, I think. I always find regex strange, not coming from a 'predominantly Unix' background... but the facility can certainly do a lot... in accomplished hands (not yet mine!).

Many thanks for the suggestions, everyone.

  • Comment on Re: Simple RegEx Substring Extraction from a Delimited Text Record

Replies are listed 'Best First'.
Re^2: Simple RegEx Substring Extraction from a Delimited Text Record
by alienhuman (Pilgrim) on Mar 15, 2006 at 16:26 UTC
    "I'm likely to want to refer to each of the data items by name elsewhere."

    This screams hash, IMO. See reasonablekeith's suggestion.

    ----------
    Using perl 5.8.6 unless otherwise noted. Apache/2.0.54 unless otherwise noted. Fedora Core 4 (2.6.11-1.1369_FC4) unless otherwise noted.
      However... contrary to a strange student in an AI class I took, hashing is not necessarily the answer to everything. But in this case, it is the answer :) .