<perl>sub convert_ubb { $temp=$_[0]; out "Start: $temp<br>"; if ($temp=~ m/\[/) { $Neu="X"; while ($Neu ne $Alt) { $SStart = index($temp,"\["); $SEnde = index($temp,"\]"); if ($SEnde == -1) { last } $STemp = substr($temp,$SStart+1,$SEnde-($SStart+1)); if (index($STemp,"=") > 0) { $STag = uc(substr($STemp,0,index($STemp,"="))); $SParam = substr($STemp,index($STemp,"=")+1); } else { $STag=uc($STemp); } $P=$SEnde+1; $TL=length($STag)+3; $L=length($temp); while ((uc(substr($temp,$P,$TL)) ne "[/".$STag."]") & ($P < $L)) { # $P++; } if ($P == $L+1) { last } $Inc = substr($temp,$SEnde+1,$P-$SEnde-1); $Alt = substr($temp,$SStart,($P+$TL)-($SStart)); $Alt=~s/\[/\\\[/g; $Alt=~s/\]/\\]/g; $Neu = $Alt; if ($STag eq "URL") { if ($SParam eq "") { $SParam=$Inc; if (index($SParam,"://") < 0) { $SParam="http://".$SParam; } } $Neu="<a href=\"$SParam\">$Inc</a>"; } elsif ($STag eq "EMAIL") { $Neu="<a href=\"mailto:$Inc\">$Inc</a>"; } elsif ($STag eq "B") { $Neu="<b>$Inc</b>"; } elsif ($STag eq "I") { $Neu="<i>$Inc</i>"; } elsif ($STag eq "IMG") { $Neu="<img src=\"$Inc\">"; } elsif ($STag eq "QUOTE") { $Neu="<blockquote>$Inc</blockquote>"; } elsif ($STag eq "CODE") { $Neu="<pre>$Inc</pre>"; } $temp=~s/$Alt/$Neu/; } } return $temp;}</perl>