Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

preg_replace()Delimiter must not be alphanumeric or backslash

Tags:

php

preg-match

I have this code :

function queryString(){ 
    //matches up to 10 digits in page number
    $query_string = eregi_replace("page=[0-9]    {0,10}&","",$_SERVER['QUERY_STRING']);
    return $query_string;
}

and when im run it returns this error: Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash

like image 983
user2386471 Avatar asked Dec 16 '22 10:12

user2386471


1 Answers

If you were to use preg_replace, you need a starting and an ending delimiter

$query_string = preg_replace("/page=[0-9]    {0,10}&/","",$_SERVER['QUERY_STRING']);
                              ^                     ^
like image 194
Bryan Avatar answered Dec 22 '22 00:12

Bryan