in reply to Re: regexp over multiple lines
in thread regexp over multiple lines

Thanks for such a detialed reply, that helps a lot. I even understood some of it! :-)

I'm beginning to see that "sluping" the file is the way to go. It would make my code less complicated and messy. From what I understand, it would also allow me to see ahead by using a regexp over several lines.

My problem is that my current code works for all the files that need processing, except this one. So, although eventually I will find the time to change it, for now I think I'm going to try to concatenate a few of the lines to hopefully achieve my goal. It may be messy, but it's the method that's least likely to mess up other areas of my code, I think.

Replies are listed 'Best First'.
Re^3: regexp over multiple lines
by ww (Archbishop) on Aug 03, 2011 at 12:24 UTC
    Consider this scenario:

    You have a contract to build a 121 story office tower. You've had problems excavating deep enough to put in the foundation. It's been a messy job but you've gotten close.

    Now, you've started pouring footings and foundation... and in fact, have managed to get the steel up for the first few stories above ground.

    That's your code to date.

    But today, your consultant -- the engineer -- notices that the walls are off plumb -- are tilting, out of whack. They ascertain that your footings and foundation are NOT on bedrock.

    Do you charge onward, to see how many stories up you can go before the whole enterprise crashes?

    Unless this is a one-off project, it's going to cost less to tear down what you've done, and get the footings right before continuing.

      The trouble is, I'm not a builder. I'm just teaching myself the building trade as I go along :-)

      This is just a once off project for my website, so the only thing it costs me is time and effort.

      I've decided that I'm going to try to do it the way everyone is recommending, I'm just not sure I have the ability to do it that way...yet. You see, the data I need to extract will be from HTML files and XML files. I will be trying to design a program that will process both types of input. I'll give it a day or two and see how I get on.

        "I'm going to try to do it the way everyone is recommending..."
        Good!

        My arms get terribly tired, beating people over the head.

        "I'm just not sure I have the ability to do it that way...yet."

        And when you have a problem -- trying to do it the right way -- why, that's why we're here. If you get stuck on some particular point (and have read the docs, etc.) post some code illustrating where you are, sample data and output, and errors from your code, if any.

        Helping folk at that point is far more gratifying than beati ^H^H^H^H^H, posting a picket line around their --- uh, applying verbal persuasion.