RegularExpression
extends Constraint
in package
Constraint that asserts that the string it is evaluated for matches a regular expression.
Checks a given value using the Perl Compatible Regular Expression extension in PHP. The pattern is matched by executing preg_match().
The pattern string passed in the constructor.
Table of Contents
- $pattern : string
- __construct() : mixed
- toString() : string
- Returns a string representation of the constraint.
- matches() : bool
- Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
Properties
$pattern
protected
string
$pattern
Methods
__construct()
public
__construct(string $pattern) : mixed
Parameters
- $pattern : string
Return values
mixed —toString()
Returns a string representation of the constraint.
public
toString() : string
Return values
string —matches()
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
protected
matches(mixed $other) : bool
Parameters
- $other : mixed
-
Value or object to evaluate.