note 22528 deleted from function.preg-replace by dams

From: Date: Fri, 21 Jun 2002 02:00:06 +0000
Subject: note 22528 deleted from function.preg-replace by dams
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-32078@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

« previous php.notes (#32078) next »