Thanks, but that isn't what I want. The point behind BBCode is allowing a small, simpler, securer, subset of HTML. I.e. [img=http://domain.com/image.gif] changes to <img src="http://domain.com/image.gif"; alt="" />
In that case:

<?php
function bbcode($text){
$text = ereg_replace("(\\[i\\])([^\\[]+)(\\[/i\\])",'<i>\\2</i>',$text);
return $text;
}
print bbcode('[i]This[/i] is a [i]test[/i].');
?>

Prints:

<i>This</i> is a <i>test</i>.


--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to