Warning: preg_match(): No ending delimiter ' '

Asked

Viewed 1,048 times

2

You’re making that mistake:

Warning: preg_match(): No ending delimiter ' ' found in /home/j17oloba/public_html/libs/lib.php on line 536

function lib_checkemail($email) 
{
if(preg_match("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$", $email, $check)) 
{
  • Try to put your regular expression between characters //. Example: /abc/.

  • You need to use delimiters in your regex, as @Oeslei mentioned. See if you solve, otherwise mention here.

2 answers

3

It is necessary to place delimiters in the regular expression, thus:

if(preg_match("/^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$/", $email, $check))

A delimiter can be any non-alphanumeric character and not even a backslash \ and not a single white space. Examples: /, #, ~, %.

More information: Delimiters

2

You need to add delimiters to your regular expression.

Example using a # at the beginning and at the end:

"#^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$#"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.