DeanWhitehouse Posted February 23, 2012 Share Posted February 23, 2012 Hello all, I'm trying to generate a regex that will remove UTM parameters from my refferrer URLs. <?php //"test" parameter is lost echo preg_replace("/&?utm_(.*)\=[^&]+/","","?utm_source=bottom&utm_medium=widget&test&test&utm_campaign=testcamp"); ?> The regex works on removing the paremeters whilst keeping parameters before and after in tact. However parameters in-between are lost. Any ideas would be great. I'm testing the above code on http://writecodeonline.com/php/ Quote Link to comment Share on other sites More sharing options...
ManiacDan Posted February 23, 2012 Share Posted February 23, 2012 So close. echo preg_replace("/&?utm_(.*?)\=[^&]+/","","?utm_source=bottom&utm_medium=widget&test&test&utm_campaign=testcamp"); Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted February 23, 2012 Author Share Posted February 23, 2012 aha thank you, I'm a bit of a newbie to regex Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.