Code: Select all
protected function getPattern($pattern)
{
if (is_array($pattern) && count($pattern)) {
$pattern = implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $pattern));
}
$pattern = '#(?:' . $pattern .')#';
if ($this->sensitive) {
$pattern .= 'i';
}
/**
* We didn't want to actually escape asterisk's
*/
$pattern = str_replace('\*', '*', $pattern);
$pattern = str_replace('*', '.*?', $pattern);
return $pattern;
}
Hmm this is seemingly more complicated for my regex mind to figure out. I've been lurking through d11's course crashes but can't seem to grasp this.
At this time I am recieving
The array I'm giving it is
Code: Select all
$files = new ScanFiles(array('ind*', 'yoo', 'index.php'));
won't match index.php
From looking at d11's example in his crash course,
I can spot the difference between his ungreedy pattern in comparison to mine. I'm starting to get the feeling it's because the | characters.
Can anyone spot where I've gone wrong?
