regex.php
Table of Contents
Functions
- regex() : string
- Generates the 'regex:/your-regex/' rule expression.
Functions
regex()
Generates the 'regex:/your-regex/' rule expression.
regex(string $regex) : string
The field under this rule must match the given regex.
Note: if you require the use of |, then the regex rule must be written in array format instead of as a string. For example:
use Somnambulist\Components\Validation\Factory;
$validation = new Factory()->validate
(
[ 'field' => 'value' ] ,
[
'field' =>
[
'required' ,
'regex' => '/(this|that|value)/'
]
]
)
Parameters
- $regex : string