Re: [PHP] Reg Ex



Hi all,

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...

<?php
var_dump( pathinfo( '.htaccess' ));
var_dump( pathinfo( 'htaccess' ));
die( );
?>

On Fri, Oct 31, 2008 at 2:57 PM, Daniel P. Brown
<daniel.brown@xxxxxxxxxxxx>wrote:

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 that
worked
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>
http://www.parasane.net/
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



--
Thanks,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt