in reply to UNO DOS, HTML
Your problem is the .*? -- although you rightly tried to limit the number of don't care characters using '?' your match still grabs the smallest number of don't care characters between '<!--' and 'DOS'... which just happens to include another '-->' and '<!--', the pieces it isn't supposed to grab.
You'll need a few baselines to come up with a workable regexp:
These would help you optimize your regexp...
But the key point is that you need to limit your regexp to a single comment group containing 'DOS'.
I'd suggest using:
$html = '<!--% xxxx UNO xxxx %--> <!--% xxxx DOS xxxx %-->'; $html =~ s/<!--%([^->]+?) DOS ([^->]+)%-->/GONE/s; print $html;
It's a little ugly, and notice that it assumes that your 'xxxx' can't contain '->', which may or may not be the case.
YMMV
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: UNO DOS
by Adam (Vicar) on Sep 13, 2000 at 04:26 UTC | |
by jreades (Friar) on Sep 13, 2000 at 17:45 UTC |