Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Regex copy and paste help

by roboticus (Chancellor)
on Aug 31, 2012 at 10:56 UTC ( #990982=note: print w/ replies, xml ) Need Help??

in reply to Regex copy and paste help


I'd suggest something like this:

Keep two sets of fields: the temporary set and the full set you're building.

  • Read a line and parse it into the temporary fields (unpack, substr)
  • If the first column exists (e.g. A00004) then it looks like you're on a new item, so:
    • If you have anything in the "full" set:
      • process it
      • write the processed data
    • Copy the temporary data into your "full" set
  • Otherwise
    • Append the existing temporary fields into your full set
  • then go back and process the next line

Finally, when you're done, if you have anything in your full set, process it.


When your only tool is a hammer, all problems look like your thumb.

Comment on Re: Regex copy and paste help

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-11-29 04:37 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 (746 votes), past polls