Page 1 of 1

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

Posted: Thu Mar 20, 2008 11:22 pm
by RoscoHead
  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. References

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

Posted: Thu Apr 03, 2008 1:02 pm
by pasamio
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.