5

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

The code:

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

What and where do I make the edit?

Simpel
  • 103
  • 1
  • 1
  • 7

2 Answers2

14

A Perl-based regex should be inside the delimiters... "/your regex here/"... the deprecated POSIX regex were the one which did not require any delimiter... For example, ereg(").

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
din din
  • 147
  • 4
8

You must add delimiters to your regex:

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

$mail_pat starts with a ^, but it ends with another character, which causes the error since there aren't any matching delimiters.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
alexn
  • 57,867
  • 14
  • 111
  • 145