this is what I use to get rid of "line" from the url $qs = ereg_replace("&$", "", ereg_replace("line=[^&]*&?", "", $QUERY_STRING));
HTH MArtin -----Original Message----- From: Scott Reismanis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 28, 2002 12:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Regex Assistance Hey All, I am just begining to learn regex functions in PHP. Anyhow I am trying to code a preg_replace function which basically cleans a URL. What I mean is say a url is index.php?page=hello&list=10&start=4 you pass that URL and say 'list' to the function (shown below) Anyhow I want that to then return index.php?page=hello&start=4 (see how the entire list reference is now gone) Here is what I have come up with so far, though I am yet to test it as I am coding this at work :) function stripUrl($url, $url_strip) { // Check that $url_strip is in the URL if(strpos($url,'?') && strpos($url, $url_strip.'=')) { // Lets clean up the url $url = preg_replace("/\?|&$url_strip=/", "", $url); } return $url; } My problem is that, how do I make the preg_replace stop when it encounters a & in the URL? If anyone could shed some light on this it would be appreciated, - Regards, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php