Use regular expressions to match query strings

Recently I had an analytics problem where I wanted to track a page, however the linked pages on the website had various tracking parameters on the query string. For example:

I wanted to group all of the URLs together to see the stats as one entity. To do this I used this regular expression:

http://(www\.website\.com\/campaigns\/page\.aspx){1}([\w- ./?&=]*)?

I’m sure there are a few ways to do it, however this expression worked very well for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>