Added "match" validation rule for regular expression checks.
This commit is contained in:
@@ -611,6 +611,18 @@ class Validator {
|
||||
return preg_match('/^([-a-z0-9_-])+$/i', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that an attribute passes a regular expression check.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate_match($attribute, $value, $parameters)
|
||||
{
|
||||
return preg_match($parameters[0], $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the MIME type of a file upload attribute is in a set of MIME types.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user