0
I’m not very good with regex and need a help to do a sort of search between files from part of the folder or file name that is at the end
$find = 'oo';
$directory = 'd:\\test';
$search = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
);
$search = new RegexIterator($search, '/'.$find.'/i');
Folders and files in the directory:
d:\test\bar foo;
d:\test\foo bar;
d:\test\text.txt;
d:\test\foo.txt;
The goal is to find folders or file parts with oo
d:\test\foo bar;
d:\test\bar foo;
d:\test\foo.txt;
I tested and it worked, but I want to make use of Recursiveiteratoriterator by being faster, even if by thousandths
– João Victor