1: <?php
2: /**
3: * Matches against a PCRE regex
4: *
5: * Based on PHPUnit_Framework_Constraint_PCREMatch
6: *
7: * @author James Pepin <james@jamespepin.com>
8: */
9: class Horde_Constraint_PregMatch implements Horde_Constraint
10: {
11: private $_regex;
12:
13: public function __construct($regex)
14: {
15: $this->_regex = $regex;
16: }
17:
18: public function evaluate($value)
19: {
20: return preg_match($this->_regex, $value) > 0;
21: }
22: }
23: