in reply to Re: Substitution inside tags, as 1 line
in thread Substitution inside tags, as 1 line

Thanks Narveson,

Nice work!

So would your full answer be:
- To put that in a while loop, and
- Add the <pre> & </pre> tag removal code, like this:

perl -0 -pe '1 while (s/(<pre>\n(?:[^\n]*<p>\n)*)([^>\n]*)\n(.*?<\/pre +>)/$1$2<p>\n$3/ms);s/<\/?pre>//g' htmlfile
?

Replies are listed 'Best First'.
Re^3: Substitution inside tags, as 1 line
by Narveson (Chaplain) on Oct 14, 2008 at 14:06 UTC

    My full answer would be:

    Perhaps you'll manage to get this to work, but really, regexes, wonderful as they are, are the wrong tool here. I offered a bit of code in the spirit of "Don't you see how hairy this is going to have to be?"

    Parse your HTML. wfsp has been kind enough to furnish details.