From: "Ian LeBlanc" <[EMAIL PROTECTED]>

>
> I am working on a site that has over 1000 pages and all the images need to
> be made lower case in the HTML.
> Here is what I have so far. Please someone tell me what I am doing wrong.
>
>
> $contents="<img src=ThisOneReallyNeedsToBeAllLowercase.gif
> alt=ThisOneReallyNeedsToBeAllLowercase.gif>";
>
> $contents =
EREG_REPLACE("([-_a-zA-Z0-9]+).gif",strtolower("\\0"),$contents);
>
>
> Output of $contents needs to equal
> <img src=thisonereallyneedstobealllowercase.gif
> alt=thisonereallyneedstobealllowercase.gif>
>
>



You need to use preg_replace which supports evaluating PHP code for the
replacement. To use preg functions you need to have compiled PHP with PCRE
(Perl Compatible Regular Expression) support.

http://www.php.net/manual/function.preg-replace.php3

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);
?>


Cheers

Simon Garner


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to