Preg_replace () The delimiter must not be an alphanumeric or backslash

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]: the delimiter should not be an alphanumeric or backslash

+4
source share
1 answer

If you must use preg_replace, you need a start and end separator

 $query_string = preg_replace("/page=[0-9] {0,10}&/","",$_SERVER['QUERY_STRING']); ^ ^ 
+11
source

Source: https://habr.com/ru/post/1480976/


All Articles