RecursiveRegexIterator
class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator (View source)
This recursive iterator can filter another recursive iterator via a regular expression.
Constants
ALL_MATCHES |
Return all matches for the current entry preg_match_all |
GET_MATCH |
Return the first match for the current entry preg_match |
MATCH |
Only execute match (filter) for the current entry preg_match |
REPLACE |
Replace the current entry (Not fully implemented yet) preg_replace |
SPLIT |
Returns the split values for the current entry preg_split |
USE_KEY |
Special flag: Match the entry key instead of the entry value. |
INVERT_MATCH |
|
Properties
$replacement | from RegexIterator |
Methods
Creates a new RecursiveRegexIterator.
Returns whether an iterator can be obtained for the current entry.
Returns an iterator for the current entry.
Details
__construct(Traversable $iterator, string $pattern, int $mode = RegexIterator::MATCH, int $flags = 0, int $pregFlags = 0)
Creates a new RecursiveRegexIterator.
Iterator|null
getInnerIterator()
Get the inner iterator
void
rewind()
Rewind the iterator
bool
valid()
Check whether the current element is valid
mixed
key()
Get the current key
mixed
current()
Get the current element value
void
next()
Move the iterator forward
bool
accept()
Get accept status
int
getMode()
Returns operation mode.
void
setMode(int $mode)
Sets the operation mode.
int
getFlags()
Get flags
void
setFlags(int $flags)
Sets the flags.
string
getRegex()
Returns current regular expression
int
getPregFlags()
Returns the regular expression flags.
void
setPregFlags(int $pregFlags)
Sets the regular expression flags.
bool
hasChildren()
Returns whether an iterator can be obtained for the current entry.
RecursiveIterator|null
getChildren()
Returns an iterator for the current entry.