[11]Backreferenced regexp in JFolder::files and folders

Joomla! Explorer
Joomla! Explorer
Posts: 318
Joined: Mon Jul 30, 2007 11:01 pm
Location: Melbourne, Australia

[11]Backreferenced regexp in JFolder::files and folders

Post by RoscoHead » Thu Mar 20, 2008 11:22 pm

  1. IntroductionCurrently, when traversing a folder for files or folders, the complete file/folder name is returned. I see a need to be able to, for instance, return the filename without an extension, or a substring of the folder name.

  2. Technical ImplementationThis would simply involve the use of the regexp backreference system to allow the user to specify a filter like /(.+)\..+/ returning the first backreference as the name, instead of the whole name.

  3. ImpactThis should not affect the current implementation, unless the programmer has used backref brackets in their regexp for their own requirements (they are currently ignored by Joomla). Non-capturing parentheses (?..) would not be affected.

    If used, this would override the fullpath parameter (which defaults to false anyway).

  4. Referenceshttp://forum.joomla.org/viewtopic.php?f=38&t=253009

Joomla! Ace
Joomla! Ace
Posts: 1318
Joined: Thu Aug 18, 2005 9:27 am
Location: San Jose, CA, USA

Re: [11]Backreferenced regexp in JFolder::files and folders

Post by pasamio » Thu Apr 03, 2008 1:02 pm

Regexp needs to be changed to something like this perhaps:
Or (being greedy):

To avoid files like this having their extension incorrectly returned:

We can't grab the .tar.gz or .tar.bz2 files or the world though perhaps we might want to put detection for that in as well.
Sam Moffatt
Updater, Installer and Authentication Systems
JoomlaCode Backend Systems



Return to “Under Review - Archived”