note 22528 added to function.preg-replace

From: Date: Fri, 21 Jun 2002 00:57:19 +0000
Subject: note 22528 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-32066@lists.php.net to get a copy of this message
I'm having a small problem... I have a guest book that I wanted to allow bold text in, like this: [b]this is bold[/b]. however I'm having a problem setting up a pattern that will work in all cases.... so far this one almost works: $string = ereg_replace("\[b](.*)\[/b]", "<b>\\1</b>",$string); at first glance, it works... but if I do this: [b]bold[/b] normal [b]more bold[/b] I get a line that is ALL bold that says this: bold[/b] normal [b]more bold can anyone point me in the right direction? I just bought a php book and although it has "regular expressions" in it... I seem to be getting no where. Thank You -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+22528 http://master.php.net/manage/user-notes.php?action=delete+22528 http://master.php.net/manage/user-notes.php?action=reject+22528

« previous php.notes (#32066) next »