in reply to Re: Re: Re: (jeffa) 5Re: More Variable length regex issues
in thread More Variable length regex issues

Don't get me wrong, regexes have their place in perl. It's part of what makes perl perl. However, I think that people have the tendency to look at every problem as a regex problem (or more generically as <insert your favorite paradigm here> problem). And, when that happens, you have people writing unnecessarily complex regexen to make the square peg fit in to the round hole. In this case, the OP had a problem where s/he had a delimited record format. If that doesn't scream split, I'll eat my hat. But, the OP had a predisposition towards using regexen at the detriment of not only readability but simplicity.

Also, I take issue (though not on a personal level) with saying that something has to be done in a certain way. Not only are you working to the exclusion of other, possibly better tools, but in some cases, your chosen tool doesn't even make sense.

thor

  • Comment on Re: Re: Re: Re: (jeffa) 5Re: More Variable length regex issues

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: (jeffa) 5Re: More Variable length regex issues
by BrowserUk (Patriarch) on Jun 09, 2003 at 12:59 UTC

    Also, I take issue (though not on a personal level) with saying that something has to be done in a certain way.

    I totally agree with that. Unreservedly.

    As for the delimited record format. Maybe I read to much into the post, but I thought that it implied of not stated, that whilst the data was essentially delimited, one or more parts of it had variable numbres of repetitions, and the delimiters were not consistant through out.

    Anyway, my tilting at this particular windmill was more a reaction to the general statement about line-noise, rather than aimed at your post specifically:) Just a convenient hook upon which to hang my own bias. Sorry.

    I think I'm having a bad day today. Perhaps I should go out and take a walk in the sunshine.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Re: Re: Re: Re: Re: (jeffa) 5Re: More Variable length regex issues
by dextius (Monk) on Jun 09, 2003 at 19:12 UTC
    Good gracious thor, you'd think what I am asking for is a crime against humanity. I already said, I want to capture and validate in one pass (of an ARBITRARY length). TWMTODI anyone? I asked in the hope of expanding my knowledge of regex's on the whole..

    It's NOT a predisposition against readability, I just need to get this regex working to the point where I can migrate this from one platform to another. Besides, split forces me to iterate, and have logic to know which filter to run on each element of the inbound data..

      I already said, I want to capture and validate in one pass
      You've said it, but you've never said why. If you want to ask a question, don't be shocked by the answer. If you're doing it to learn, fair enough. But realize that most every other programmer would use split for it's succinctness. Moreover, I subscribe to the "every function can be explained by one sentence not using the word 'and'". You are trying to capture and validate. When something breaks, you've more debugging to do as you're trying to do two things at once.

      thor