php - preg_match(): Delimiter must not be alphanumeric or backslash - but I use #? -


i above error - , have looked in post answer. thing use # delimiter , still error. have tried ~  , no other result.

$checkcode ="#^[a-z0-9]{8}$#";  if (preg_match($code, $checkcode)) {do stuff} 

what do wrong - or should error? lot ! ;) best regards, louise

you have use:

$re = "~^[a-z0-9]{8}$~";  $str = "...";   if(preg_match($re, $str, $matches)) { ...} // or if(preg_match($re, $str)) { ...} 

check documentation:

int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -