Add GLOB_BRACE option for better pattern searches. #798

Merged
merged 1 commit into from Jan 24, 2013

2 participants

@blainesch
Union of RAD member

I'm basically trying to do something like this:

Libraries::paths(array(
    'rules' => array(
        '{:library}\extensions\test\rules\{:class}\{:name}',
        '{:library}\test\rules\{:class}\{:name}' => array('libraries' => 'li3_quality'),
    ),
    'ruleSets' => array(
        '{:library}\test\*{rules,defaultRules}',
    ),
));
$ruleSets = Libraries::locate('ruleSets', null, array(
    'recursive' => false,
    'suffix' => '.json',
    'preFilter' => '/(r|defaultR)ules\.json/',
    'format' => false,
));

This sets priority and better matching.

Removing the *{rules,defaultRules} and replacing it with {:name} would cause them to be out of order, at which point I'd need to sort them since I want to only match the first one and use defaultRules as a last resort.

If I remove the preFilter rules.json wont match since the default regex requires an uppercase letter to match.

@nateabele
Union of RAD member

Well, strictly speaking, locate() is for classes, but hey, if it works, it works.

@nateabele nateabele merged commit 6a5691c into UnionOfRAD:dev Jan 24, 2013
@blainesch blainesch deleted the unknown repository branch Jan 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment