Re: regex
| From: | Gerard Samuel | Date: | Tue, 11 Jun 2002 22:28:18 +0000 |
| Subject: | Re: regex | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101635@lists.php.net to get a copy of this message | ||
Well Ive gotten
(.*)
and
([a-z]*[0-9]*_*-*)
to work thus far as the first group.
I would like to avoid option 1, and option 2 doesn't seem right....
Gerard Samuel wrote:
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/