Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
There's much wrong with your program. First, if you are
going to modify the file line-by-line, it's a total waste
to first read in all lines into an array. However, when
dealing with HTML, it's wrong to look at individual lines.
HTML does not have a concept of lines, and tags can have
newlines inside them.
As for the regexes, the first pattern will not do the right thing if there's another tag at the same line. The second pattern will fail to do the right thing if the anchor has another attribute before "HREF", or if it has an attribute value containing a ">". You would be far better off using one of the many HTML parsing modules found on CPAN. Abigail In reply to Re: Regexps to change HTML tags/attributes
by Abigail-II
|
|