RE: [PHP] Regex Assistance

2002-05-28 Thread Scott Hurring
This should work for most cases: function strip_key($key, $string) { $string = preg_replace("/(&|\?)($key=(\w+)?)(&?)/", '$1', $string); return preg_replace('/(\?|&)$/', '', $string); } print strip_key("list", "yadda?bo=ra&list=XXX&two=three"); print strip_key("list", "yadda?bo=ra&list=&two=

RE: [PHP] Regex Assistance

2002-05-27 Thread Martin Towell
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] R