in reply to Re: (Ovid) Re(2): Silly Regex question...
in thread Silly Regex question...

The actual text being matched against didn't contain any occurences like the example you give above... And you know what? That's exactly what I expected. How often do you have HTML that contains angle brackets within attribute values?

Surely the issue here isn't really what the "actual text" contained.

For one thing, we don't know what it contained, so we couldn't answer based on that.

For another, do you *really* know what text this code might be run on in the future? Really?

This is a public forum. People come here looking for answers to their problems. People will look at the code submitted and say "Aha! *That* will solve my problem". And then go use the code on data that some day might just cotain HTML with angle brackets within attribute values, no matter how strange it may seem to you.

People often say things like "Using Module::Foo is overkill for this, so I'll just roll my own.".

I really don't believe that is really the case very often. Using the HTML parsing modules, for example, even for the most trivial cases, is A Good Thing(tm). It breeds familiarity with the modules, so that when you need to use them for something more complex later, you'll have a better idea of what you're doing. They'll probably do what you want in a much better way - even when your circumstances change. And they're much more likely to do what someone else wants without having to worry about whether their circumstances are different from yours.

People have written the code already and had it debugged by lots of other users so that a lot of the gotchas have already been removed. Always use it first. It's there. If it's not there, then installing it is probably quicker than writing your own. Especially if you're having problems that you have to come somewhere like here about.

Only not use pre-written code if you want to do *MORE* than it can. Not if you want to do *LESS*.

Use laziness. It's a virtue, you know.

Tony

  • Comment on Re: Re: (Ovid) Re(2): Silly Regex question...