try this:
1. you need to find a "<font" starter. and it needs a closing ">"...
2. everything between it is an attribute with a value, right? and their order is random.
once you can grab that string, it's as simple as EXPLODE'ing it using the space as a separator.
for example:
PHP Code:
$font_string = '<font face="verdana" size="2">';
$font_string_array = explode (" ", $font_string);
// now just loop $font_string_array and look up the ATTRIBUTE
// reserve words like FACE, SIZE, COLOR, etc.
foreach ($font_string_array as $attrib)
{
// also, you need to deal with the $attrib[0] and $attrib[n] since
// those are the beginning and the end of the string...
// unless of course you have already stripped out the "<font" and the terminating ">" out of the original string...
$attrib_parts = explode ("=", $attrib);
// if everything went right:
// $attrib_parts[0] = "face"
// $attrib_parts[1] = "verdana" according to your sample...
switch ($attrib_parts[0])
case "face":
$ubb_string = $ubb_string + "[font=" . $attrib_parts[1] . "] ";
$closer_string = $closer_string + "[/font=" . $attrib_parts[1] . "] ";
break;
case "size":
$ubb_string = $ubb_string + "[size=" . $attrib_parts[1] . "] ";
$closer_string = $closer_string + "[/size=" . $attrib_parts[1] . "] ";
break;
// insert the rest of the attributes here...
now, i didnt do any error checking if the actual values for each attrib is valid. that's up to you.. 
also, you have to deal with the actual text that is between the html... but that's the easy part...
Bookmarks