class RegexDirectoryIterator extends FilterIterator (View source)

Iterates over files whose names match a regular expression in a directory.

Properties

protected string $regex

The regular expression to match.

Methods

__construct(string $path, string $regex)

RegexDirectoryIterator constructor.

accept()

Implements \FilterIterator::accept().

Details

__construct(string $path, string $regex)

RegexDirectoryIterator constructor.

Parameters

string $path

The path to scan.

string $regex

The regular expression to match, including delimiters. For example, /.yml$/ would list only files ending in .yml.

accept()

Implements \FilterIterator::accept().