P
P
Petro Boyko2018-04-13 17:55:09
PHP
Petro Boyko, 2018-04-13 17:55:09

How to fix regular expression of phone number validation?

Help me fix the regular expression, otherwise I twist it here and there and display an error
, you need to exclude the international code from the regular expression, you need to check after the international code

if (!preg_match("/((0|\+3)-?)?\(?\d{3,5}\)?-?\d{1}-?\d{1}-?\d{1}-?\d{1}-?\d{1}((-?\d{1})?-?\d{1})?/", $phone)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question