Google Analytics – Using RegEx to find a word starting with and ending with

I was working on creating a new segment in Google Analytics with the following conditions –

  1. The event name should start with “Scroll Tab”
  2. And the event name should end with “Run”

To create such complex conditions, we need to make use of Regular Expressions (RegEx) in Google Analytics.

In this case, I make use of three symbols –

  1. ^ which means “begins with”
  2. $ which means “ends with”
  3. And .* which means everything in between the start and the end

So if I have to find events starting with “Scroll Tab”, ending with “Run” and anything in between then this is the RegEx that I can use –

^ScrollTab.*Run$

I learned about these RegEx symbols from this awesome blog post. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s