Documentation

RegularExpression extends Filter
in package

Class \Hoa\Iterator\RegularExpression.

Re-implement the SPL RegexIterator class. There are too many bugs in php-src and HHVM, so we re-implement it from scratch without extending the existing class.

Inspired by hhvm://hphp/system/php/spl/iterators/RegexIterator.php

Tags
copyright

Copyright © 2007-2017 Hoa community

license

New BSD License

Table of Contents

Constants

ALL_MATCHES  = 2
Mode and preg flag: all matches for the current entry.
GET_MATCH  = 1
Mode and preg flag: first match for the current entry.
INVERT_MATCH  = 2
Flag: invert match.
MATCH  = 0
Mode and preg flag: only execute match (filter) for the current entry.
REPLACE  = 4
Mode and preg flag: replace the current entry.
SPLIT  = 3
Mode and preg flag: split values for the current entry.
USE_KEY  = 1
Flag: match the entry key instead of the entry value.

Properties

$replacement  : string
Replacement.
$_current  : string
Current value.
$_flags  : int
Special flags, see the \RegexIterator::setFlag method for a list of available flags.
$_key  : int
Current key.
$_mode  : int
Operation mode, see the \RegexIterator::setMode method for a list of modes.
$_pregFlags  : int
The regular expression flags. See constants.
$_regex  : string
The regular expression to match.

Methods

__construct()  : mixed
Constructor.
accept()  : bool
Get accept status.
current()  : string
Get current value.
getFlags()  : int
Get flags.
getMode()  : int
Get mode.
getPregFlags()  : int
Get preg flags.
getRegex()  : string
Get regular expression.
key()  : int
Get current key.
setFlags()  : void
Set flags.
setMode()  : void
Set mode.
setPregFlags()  : void
Set preg flags.

Constants

ALL_MATCHES

Mode and preg flag: all matches for the current entry.

public mixed ALL_MATCHES = 2
Tags
const

int

GET_MATCH

Mode and preg flag: first match for the current entry.

public mixed GET_MATCH = 1
Tags
const

int

INVERT_MATCH

Flag: invert match.

public mixed INVERT_MATCH = 2
Tags
const

int

MATCH

Mode and preg flag: only execute match (filter) for the current entry.

public mixed MATCH = 0
Tags
const

int

REPLACE

Mode and preg flag: replace the current entry.

public mixed REPLACE = 4
Tags
const

int

SPLIT

Mode and preg flag: split values for the current entry.

public mixed SPLIT = 3
Tags
const

int

USE_KEY

Flag: match the entry key instead of the entry value.

public mixed USE_KEY = 1
Tags
const

int

Properties

$_flags

Special flags, see the \RegexIterator::setFlag method for a list of available flags.

protected int $_flags = 0

$_mode

Operation mode, see the \RegexIterator::setMode method for a list of modes.

protected int $_mode = 0

$_pregFlags

The regular expression flags. See constants.

protected int $_pregFlags = 0

Methods

__construct()

Constructor.

public __construct(RecursiveIterator $iterator, string $regex[, int $mode = self::MATCH ][, int $flags = 0 ][, int $pregFlags = 0 ]) : mixed
Parameters
$iterator : RecursiveIterator

The recursive iterator to apply this regex filter to.

$regex : string

The regular expression to match.

$mode : int = self::MATCH

Operation mode, please see the \RegexIterator::setMode method.

$flags : int = 0

Special flags, please see the \RegexIterator::setFlags method.

$pregFlags : int = 0

Regular expression flags, please see \RegexIterator constants.

current()

Get current value.

public current() : string
Return values
string

getPregFlags()

Get preg flags.

public getPregFlags() : int
Return values
int

getRegex()

Get regular expression.

public getRegex() : string
Return values
string

setFlags()

Set flags.

public setFlags(int $flags) : void
Parameters
$flags : int

Flags.

setMode()

Set mode.

public setMode(int $mode) : void
Parameters
$mode : int

Mode.

setPregFlags()

Set preg flags.

public setPregFlags(int $pregFlags) : void
Parameters
$pregFlags : int

Preg flags.


        
On this page

Search results