Preg_match (): final delimiter '^' not found

Warning: preg_match (): trailing delimiter '^' found in ... /functions/validations.php on line 29

The code:

 if (preg_match($mail_pat, $email, $components)) {

What and where to do the editing?

+5
source share
2 answers

Perl-based Regex must be inside delimiters. "/your regex here/".. the obsolete POSIX regular expression was one that did not require any division. For example, ereg (")

+13
source

You must add delimiters to your regular expression:

if (preg_match('/' . $mail_pat . '/', $email, $components)) {

$ mail_pat starts with ^, but ends with another character, which causes an error because there are no matching delimiters.

+8
source

All Articles