AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2K members online now
2K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
Guide Me

Filter to strip out entire query string

Google Employee
# 1
Google Employee

This popular discussion was copied from the former Help Forum, answered by

Whims/vgrinko14 (TC/member)



Hello everyone,


in one of my GA views I need to strip out all query string parameters using filter.

I was advised to create search and replace filter with the following configuration:

Dimension: Request URI

Search String: ^([^\?]+)\?.*

Replace String: \1


I am looking at "Replace String" I don't get what it means "\1". Can anyone help me understand how this filter works?


Whims, thank you for your reply!

Actually, it seems to be working as expected in my test view, but I didn't understand why initially.

Now I discovered, that "\1" is actually "back reference" for everything what matches regular expression "[^\?]+" - in the brackets.


So my filter works as that it extracts content from the RequestURl before "?" sign, and replaces entire Request URl with this substring.

After some investigation I found these discussions, which other people may also find useful:


2) Info about Regexp Back-references:


given by Whims/vgrinko14 (TC/member)

1 Expert replyverified_user

Re: Filter to strip out entire query string

Google Employee
# 2
Google Employee
Hope you find this thread useful; let us know by starring it. Thanks!