Re: regex
| From: | Jim lucas | Date: | Tue, 11 Jun 2002 23:58:28 +0000 |
| Subject: | Re: regex | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101645@lists.php.net to get a copy of this message | ||
$file = preg_replace('/^([a-z0-9\-\_]*).([a-z]{3,4})$/i', $new_file .
".$2", $_FILES['upload']['name']);
Maybe this?
Jim Lucas
----- Original Message -----
From: "Gerard Samuel" <gsam@trini0.org>
To: "PHP" <php-general@lists.php.net>
Sent: Tuesday, June 11, 2002 3:11 PM
Subject: [PHP] regex
> Im expecting a string like foo.png.
> Im trying to replace 'foo' with another value that I have.
> Im trying this ->
> $file = preg_replace('/([a-z][0-9]-_*)(.[a-z]{3,4})/i', $new_file .
> "$2", $_FILES['upload']['name']);
>
> The second regex group works ok, its the first one I cannot figure out.
> It is supposed to contain alpha numeric characters and '_' and '-'.
> Thanks for any input.
>
> --
> Gerard Samuel
> http://www.trini0.org:81/
> http://dev.trini0.org:81/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>