hi, i have a problem with regex, im trying to change [ b][ /b] to <b></b> with this code
function Format($txt)
{
$txt = eregi_replace('\[b\](.*)\[/b\]', '<b>\\1</b>', $txt);
return $txt;
}
But it seems to be greddy and wants to trap more than it needs, to a txt like [ b]bold[ /b] not [ b]bold[ /b] will become <b>bold[ /b] not [ b] bold</b>
After some googling i found the ? ungreediness thing, but if i try to use it
Warning: eregi_replace() [function.eregi-replace]: REG_BADRPT in phpfile.php on line 649
And i also try using preg_replace function instead, but i get
Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in phpfile.php on line 648
Any Ideas?