Re: [PHP] Reg Ex
- From: dafneves@xxxxxxxxx ("Diogo Neves")
- Date: Fri, 31 Oct 2008 17:08:25 +0000
It depends on what he really want, but pathinfo really is a better option
My test worked perfectly on files with no extension and without name...
var_dump( pathinfo( '.htaccess' ));
var_dump( pathinfo( 'htaccess' ));
On Fri, Oct 31, 2008 at 2:57 PM, Daniel P. Brown
On Fri, Oct 31, 2008 at 9:53 AM, Kyle Terry <kyle@xxxxxxxxxxxxx> wrote:
Thanks for the reply. For now I used substr($filename,0,-4) and thatworked
perfectly. I need to learn reg ex badly :(.
Before you do that, learn to read and follow along in an email
thread that you start. We gave you perfect pointers as to (a) why
regexp's aren't needed in this case; and (b) how to better handle it.
Your substr() routine won't work as expected in all cases.
Imagine either an .htaccess file or an extensionless file named
`quagmire`. You'll come up with `cess` and `mire`, respectively.
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
Ask me about our current hosting/dedicated server deals!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Web Developer @ SAPO.pt by PrimeIT.pt