Re: string function that adds before and after
| From: | Matt M. | Date: | Fri, 25 Jun 2004 18:24:13 +0000 |
| Subject: | Re: string function that adds before and after | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189070@lists.php.net to get a copy of this message | ||
> There's a number of functions in PHP that will give me the position of
> the *first* instance of the matched string, but it doesn't look like the
> function would keep searching after the first match. Anyway, am I
> overlooking a function that already has the functionality that I'm
> searching for? Or does anyone have any ideas how I can accomplish this
> efficiently since my search strings can be quite long?
try this
preg_replace('/(weather)/i', "<strong>$1</strong>", 'This is
the worst
weather ever. Weather around
here is terrible. ')