* Kontra, Gergely (kgergely / mlabdial.hit.bme.hu) wrote:

> Consider
> <TR>
> <TD><IMG SRC="Ouch" ALT="Evil </TR>">
> </TD>
> </TR>

Um, isn't that just a bit invalid?

<tr>
<td><img src="Ouch" alt="Evil &lt;/tr&gt;">
</th>
</tr>

&, < and > do not cease being special when inside an attribute (which
also means when you link something containing an &, you should put it as
&amp;, not a naked &).

Anyway, a more realistic example is:

<tr>
<td><table><tr><td>Another cell</td></tr></table></td>
</tr>

Or if you're trying to rip out quotes:

<q>He said <q>She said <q>They said <q>no</q></q></q>, which was nice.</q>

Where you get "He said <q>She said <q>They Said<q>no" if you just match
<q>.*?</q>.

Regexp's are best used in situations like this to scan to the next tag;
leaving all the processing up to regexp is rather beyond it's
capabilities.

This is, of course, one reason to start using XHTML :)

-- 
Thomas 'Freaky' Hurst  -  freaky / aagh.net  -  http://www.aagh.net/
-
Truthful, adj.:
	Dumb and illiterate.
		-- Ambrose Bierce, "The Devil's Dictionary"