in reply to Re: Parse a block of text
in thread Parse a block of text

that works, thanks so much! Just curious, how would you do it with regexes?

Replies are listed 'Best First'.
Re^3: Parse a block of text
by dragonchild (Archbishop) on Jul 08, 2008 at 00:42 UTC
    Your problem is that you're reading a line at a time. This means you don't have the information you need until it's too late. You'd have to switch to reading two lines at a time and that's just silly. But, you'd use a positive lookahead, in-string line anchors, and the sm modifiers.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?