depage-forms
v2.0.0
html forms made easy
Toggle main menu visibility
Loading...
Searching...
No Matches
RegEx.php
Go to the documentation of this file.
1
<?php
2
7
8
namespace
Depage\HtmlForm\Validators;
9
13
class
RegEx
extends
Validator
14
{
18
protected
$regEx
=
"//"
;
19
27
public
function
validate
($value, $parameters = [])
28
{
29
$match = (bool) preg_match($this->regEx, $value, $matchedSubstring);
30
36
$completeMatch = $match && ($value === $matchedSubstring[0]);
37
38
if
(preg_last_error() !== PREG_NO_ERROR) {
40
$this->
log
(
"Regular expression warning: error code "
. preg_last_error());
41
}
42
43
return
$completeMatch;
44
}
45
52
public
function
setRegEx
(
$regEx
)
53
{
54
$this->regEx =
$regEx
;
55
}
56
}
Depage\HtmlForm\Validators\RegEx
customizable validator for input elements
Definition
RegEx.php:14
Depage\HtmlForm\Validators\RegEx\$regEx
$regEx
regular expression
Definition
RegEx.php:18
Depage\HtmlForm\Validators\RegEx\validate
validate($value, $parameters=[])
validates value with regular expression
Definition
RegEx.php:27
Depage\HtmlForm\Validators\RegEx\setRegEx
setRegEx($regEx)
sets the validators regular expression
Definition
RegEx.php:52
Depage\HtmlForm\Validators\Validator
parent validator class
Definition
Validator.php:16
Depage\HtmlForm\Validators\Validator\log
log($argument, $type)
error logging method
Definition
Validator.php:89
Validators
RegEx.php
Generated on
for depage-forms by
doxygen
1.18.0
For an overview of all docs, go to
docs.depage.net