This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
AlecSPB
Hi. Need help in solving a form validation using regex.
My code is as follows. When submitting the form, an error occurs: preg_match(): No ending delimiter '/' found on line....
On the website https://regex101.com/r/iB4tK1/1 code (+7|8)((\d{3})|\d{3})\d{7}$ everything works good.
Where I missed the delimiter '/'?
My code:
$validator = Validator::make(
[
'name' => $name,
'phone' => $phone,
],
[
'name' => 'required|alpha|min:2',
'phone' => 'required|regex:/(\+7|8)(\(\d{3}\)|\d{3})\d{7}$/',
],
[
'required' => 'Пожалуйста, представьтесь.',
'min' => 'Введите свое настоящее имя!',
'alpha' => 'Вводите только буквы A-z А-я!',
'regex' => 'Введите телефон в формате 8(ххх)ххххххх',
]
);
1-1 of 1