I have a search and replace filter that should "roll up" pages underneath different apps.

MY URLs have the structure hostname/app-name/page.htm?query

App name could be one of several options.

My intent is that if I have requests come in on both




That both those requests get counted as "hits" for page.htm

I have the following ^/(dave|susan|adam)/([^\?]+)\?.*

and have set the replace field to be /2

I can see hits being rolled up for page.htm but am also seeing dave/page.htm and susan/page.htm show up.

What am I doing wrong?

  • The filter field is of course set to Request URI Mar 19 '14 at 15:11

Google's documentation for these filters doesn't mention that they can use regular expression groups for matching. I think that when you say /2 you are trying to fill in the second matching group. The normal regular expression syntax for that would include either a $ or a \ before the number. If it were going to work, it would either be /$2 or /\2.

I don't think you need functionality at all. You could just use the regular expression ^/(dave|susan|adam)/ on the Request URI field and replace it with /. That should work because it is almost exactly like the example used on the documentation page.

  • Thanks for the answer. I'm no longer working on the project I needed this for so am unable to test this but this sounds like the right answer so I will give you the tick. :) Jan 15 '15 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.