in reply to Re: Supplying the RHS to a regex as a variable
in thread Supplying the RHS to a regex as a variable

I can easily break this code by feeding it a valid html string:
$s = ' <p>something something</p> <h2>blah <<< blah blah</h2> <p>something something</p> ';

Update:

BUU, although parsing is not the purpose, you have to realize that implicitly it is done any way. Regexp is obviously a kind of parsing, and it has been repeatedly mentioned by many monks here that, regexp is not a good way to deal with html.

It is not an easy task to come up with perfect regexp for dealing with html.

On the other hand, although the purpose is not parsing, parsing is still a valid tool, isn't it? In this case, actually a better tool.

Replies are listed 'Best First'.
Re: Re: Re: Supplying the RHS to a regex as a variable
by BUU (Prior) on Oct 18, 2003 at 07:21 UTC
    But he's not parsing html. The parent node never even mentioned parsing html. All he wants to do is match a certain substring and replace it with another one. The minor fact that this string happens to contain data that superficially resembles html has absolutely no bearing on this.