That wouldn't happen.
The code I use in my font hack for UBB.classic looks like this:
my $match = 1;
while($match != 0) {
$match = 0;
$match++ if $text =~ s~(<font (.+?)>)(.+?)(</font>)~\[font $2\]$3\[/font\]~is;
}
Here's how it works:
Initially: <font style="courier"><font color="red"><font size="5"> Red courier, size 5 </font></font></font>
After iteration 1: <font style="courier"><font color="red">[font size="5"] Red courier, size 5 [/font]</font></font>
After iteration 2: <font style="courier">[font color="red"][font size="5"] Red courier, size 5 [/font][/font]</font>
After iteration 3: [font style="courier"][font color="red"][font size="5"] Red courier, size 5 [/font][/font][/font]