Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
December 16, 2008, 5:16 pm
rate this thread
Having just used this FAQ yesterday (copying the above regex directly into
my code and being pleased when it worked quite well), I know I had little
interest in understanding precisely how it worked. I know that all the
constructs are explained in perldoc perlre, and I could look them up there
if I wanted to, although the ones above seem to be ones I already know.
Knowing why they were assembled in the manner they were is more about
understanding the structure of HTML than it is about Perl, so I don't know
that dwelling on that in a Perl FAQ is warranted. If the regex had been
presented scattered over a dozen lines, using /x, I know that would have
annoyed me quite a bit. After all, I wanted to strip out HTML, not get
a lesson in regex, which is adequately covered elsewhere. IMHO, an
explanation of the above would generally fall into one of two categories.
Too abbreviated to do much good, or too long to really belong in this FAQ.
I'd be happy to be proven wrong and see something both short and useful,
but I'm skeptical enough about it happening that I don't think I'll try to
come up with it myself.
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
Re: FAQ 9.4 How do I remove HTML from a string?
It's not that, it's just that the writing is poor. You should never
assume that code speaks for itself, so the answer should also say it in
words such as "This regex looks for an opening angle bracket....". With
a couple of sentences you reinforce the point in a different way.
However, the whole answer needs to be fixed up, and a could answer can
take a couple of whole evenings to write and edit.
- » FAQ 2.1 What machines support perl? Where do I get it?
- — Previous thread in » PERL Discussions