RE: [PHP] Re: How do I do this
| From: | Boget, Chris | Date: | Thu, 13 Dec 2001 20:40:50 +0000 |
| Subject: | RE: [PHP] Re: How do I do this | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77670@lists.php.net to get a copy of this message | ||
> This is untested, but something like...
> $str = "[hi] there, this is me [HI] there, this is me";
> $newstring = ereg_replace("(\[[A-Z]*])", "<br>\\1", $str);
> should do it.
> using the Perl regexe's might make it easier, but that should work.
That worked perfectly. Is there any way I can make it so that
it'll put the <br> there in every instance except for when it's
preceded by another square bracket.
So this:
[hi] there, this is me [HI] there, this is me
would turn into this:
[hi] there, this is me <br>[HI] there, this is me
(which is the script that you sent me and works beautifully)
but this:
[hi] there, this is me [HI][HI] there, this is me
won't turn into this:
[hi] there, this is me <br>[HI]<br>[HI] there, this is me
?
Chris
-still learning regular expressions