$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" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
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
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to