Re: String manipulation with ereg_replace
| From: | Christian Reiniger | Date: | Thu, 22 Feb 2001 23:14:54 +0000 |
| Subject: | Re: String manipulation with ereg_replace | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41233@lists.php.net to get a copy of this message | ||
On Thursday 22 February 2001 23:42, Simon Garner wrote:
> This should do the trick (untested!):
>
> <?
> $contents = "<img src=ThisOneReallyNeedsToBeAllLowercase.gif
> alt=ThisOneReallyNeedsToBeAllLowercase.gif>";
>
> $contents = preg_replace("/([-_a-zA-Z0-9]+)\.gif/e",
> "strtolower('\\1') . '.gif'", $contents);
> ?>
simpler that
"/([-_a-zA-Z0-9]+)\.gif/e"
is
"/([-\w]+)\.gif/e"
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Google results 1-10 of about 142,000,000 for e. Search took 0.18 seconds.
- http://www.google.com/search?q=e