Show Menu

Google Analytics Regular Expressions Cheat Sheet by

A list of Regular Expression functionality supported by Google Analytics


Start of line
End of line

Character Classes

White space character
Non-white space character
Digit character
Non-digit character
Non-word (e.g. punctu­ation, spaces)

Metach­ara­cters (must be escaped)


GA Filter group accessors

Access group x in field A (e.g. $A1)
Access group x in field B (e.g. $B1)


Zero or more (greedy)
Zero or more (lazy)
One or more (greedy)
One or more (lazy)
Zero or one (greedy)
Zero or one (lazy)
Exactly X (e.g. 3)
X or more, (e.g. 3)
{X, Y}
Between X and Y (e.g. 3 and 5) (lazy)

Ranges and Groups

Any character
a or b (case sensitive)
Group, e.g. (keyword)
Passive group, e.g. (?:key­word)
Range (a or b or c)
Negative range (not a or b or c)
Uppercase letter between A and Z
Lowercase letter between a and z
Digit between 0 and 7

Sample Patterns

Any page URLs starting with /direc­tory/

Brand term with or without whitespace between words

Key phrases beginning with 'brand' and the second word not starting with c or f

URLs ending in '.aspx'

"OR­DER­-" followed by a six digit ID

Value of 'utm' querys­tring parameter

Share This Cheat Sheet!

Favourited by 20 Cheatographers:

MoakDesigns damerms MDT pdpmatt earthlydelight zatatat afdesigns Chilly_Bang multistreams Dranzz cthumerelle and 10 more ...


DaveChild DaveChild, 08:11 11 Feb 12

Great cheat sheet, Jay, especially the sample patterns!

Jay Taylor Jay Taylor, 18:10 11 Feb 12

Thanks Dave! Obviously it's based heavily on your main RE one, I'm really hoping Google will add support for assertions in the future, would make life so much easier!

Brian CLifton Brian CLifton, 09:59 23 Feb 12

Nice cheat sheet Jay

I don't think you need this one:

as just (brand) will work, no? That is, (brand) will match:
"brandterm", and "brand term"

Sean Hughes Sean Hughes, 09:59 23 Feb 12

Excellent cheat sheet Jay, really helpful.

Tim Leighton-Boyce Tim Leighton-Boyce, 10:07 23 Feb 12

This is really helpful. Thank you Jay. Just the kind of resource we need.

Modi Modi, 15:19 26 Feb 12

Good stuff Jay! Thanks for sharing.

Marc Beharry Marc Beharry, 14:44 6 Aug 12

thanks much Jay!!

Chaitanya Chaitanya, 14:44 6 Aug 12

Great information, really awesome..

Surbhi Surbhi, 13:16 6 Mar 13

Cant thank you enough for this amazing resource!

gabe gabe, 17:16 26 Mar 13

I do have a file name LIKE maxfile_[A-Z]_[0-9]{6} and I want to use a wild card like ^maxfile_ but it does not work

James James, 16:30 5 Apr 13

Hi guys,

Just a short question on using the right regular expression. I want to create a funnel which has to gather information on different URL's. The one thing that all the URLs have in common is their last part. For example, i want to include al these URL's in one step of a funnel:


> They all have the same last part; 'step4'. Which regulare expression do i have to use to collect the data of all these different pages?

Hope you can help me!

Zaib Zaib, 14:18 13 Feb 14


user this regex:

The Battosai The Battosai, 15:09 13 Feb 14


That would be

Gaurav Gaurav, 12:06 14 Feb 14

What about "#" ?
i need to create the rule that only fires up on deep links.
Any help would be appreciated.

Jackson Oh Jackson Oh, 09:03 26 Feb 14

Thank you so much for the cheat sheet!

Scott Scott, 09:58 17 Mar 14

I have a goal that could encompass any number after /offer. Would this be correct?



Ana Ana, 10:14 4 Jun 14

+ Información y Documentación en Español

Jasper Jasper, 17:48 5 Jun 14

I've have an question i have the following link:


now in my google goals he's only showing the visits

(?:brand) containing brand

but i want to exclude the word brand instead of showing it

how can i fix that?

Christopher Christopher, 08:29 9 Oct 14

This is cool

Im looking to do a GA filter to filter out several versions of internet explorer

Currently doing One at a time

and have 9\.11 as the pattern

is that correct?

igor igor, 16:09 12 Nov 14

hi! I have page

i need to set a goal with "buy" or "b6b6457d__-1936669385__" how to do that? thanks

miguelangel miguelangel, 13:07 27 Jan 15

hello I need your help, I have these ejm for goals:

Use regular expression:

But I still do Not report goals at analytics, it may be problem with the "#" ?


Dominik Bach Dominik Bach, 15:51 13 Nov 15

Is this sheet still valid (2015 November)? The original post is from 2012.

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.