My string is
"http://exanmple.com/katalogas/?is_search=1&type=list&filter=search_1&activity=&activity_id=&activity=langai&activity_id=®ion_id=-2&page_no=2"
I want replace from string all page_no=2
number can change, phrase is static page_no
What I try:
/\&page_no=[0-9]\b/i
You can match this regex:
/(?<=\?)page_no=\d+&|&page_no=\d+\b/i
Code:
$url = preg_replace('/(?<=\?)page_no=\d+&|&page_no=\d+\b/i', '', $url);