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

Perl based regex should be inside the delimeters.. "/your regex here/".. the deprecated POSIX regex were the one which did not require any delimeter.. eg ereg(")

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 ends with another character, which causes the error since there are no matching delimiters.

alexn
  • 55,635
  • 14
  • 110
  • 143