Inspekt\Inspekt::isRegex PHP 메소드

isRegex() 공개 정적인 메소드

Returns true if value matches $pattern, false otherwise. Uses preg_match() for the matching.
public static isRegex ( mixed $value, mixed $pattern ) : mixed
$value mixed
$pattern mixed
리턴 mixed
    public static function isRegex($value, $pattern)
    {
        return (bool) preg_match($pattern, $value);
    }

Usage Example

예제 #1
0
 /**
  * @todo Implement testIsRegex().
  */
 public function testIsRegex()
 {
     $input = 'username_786';
     $regex = '/[a-zA-Z0-9_]/';
     $this->assertTrue(Inspekt::isRegex($input, $regex));
 }