Re: Reg Ex

From: Date: Fri, 31 Oct 2008 17:08:25 +0000
Subject: Re: Reg Ex
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-282716@lists.php.net to get a copy of this message
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@parasane.net>wrote: > On Fri, Oct 31, 2008 at 9:53 AM, Kyle Terry <kyle@kyleterry.com> 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 ’Hw—…&›?¢” … œ > cess and mire, respectively. > > -- > </Daniel P. Brown> > http://www.parasane.net/ > daniel.brown@parasane.net || danbrown@php.net > 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

« previous php.general (#282716) next »