You are on page 1of 1

Google Analytics Regular Expressions Cheat Sheet

by Jay Taylor (Jay Taylor) via cheatography.com/573/cs/243/

Anchors Quanti​fiers Sample Patterns

^ Start of line * Zero or more (greedy) ^/di​rec​tor​y/(.*)

$ End of line *? Zero or more (lazy) Any page URLs starting with /direc​tory/
(bra​nd​\s*?​term)
+ One or more (greedy)
Brand term with or without whitespace between
Character Classes
+? One or more (lazy) words
\s White space character ? Zero or one (greedy) ^br​and​\s+​[^cf]
\S Non-white space character Key phrases beginning with 'brand' and the
?? Zero or one (lazy)
second word not starting with c or f
\d Digit character {X} Exactly X (e.g. 3)
\.as​px$
\D Non-digit character {X,} X or more, (e.g. 3) URLs ending in '.aspx'
\w Word {X, Y} Between X and Y (e.g. 3 and 5) (lazy) ORDE​R\-​\d{6}
\W Non-word (e.g. punctu​ation, spaces) "OR​DER​-" followed by a six digit ID

Ranges and Groups (?:​\?|&)u​tm=​([^​&$​]+)

Metach​ara​cters (must be escaped) Value of 'utm' querys​tring parameter


. Any character
^ [ ] (a|b) a or b (case sensitive)
$ ( ) (...) Group, e.g. (keyword)
. { } (?:...) Passive group, e.g. (?:key​word)
* + ? [abc] Range (a or b or c)
\ | - [^abc] Negative range (not a or b or c)

[A-Z] Uppercase letter between A and Z


GA Filter group accessors
[a-z] Lowercase letter between a and z
$Ax Access group x in field A (e.g. $A1)
[0-7] Digit between 0 and 7
$Bx Access group x in field B (e.g. $B1)

By Jay Taylor (Jay Taylor) Published 10th February, 2012. Sponsored by Readability-Score.com
cheatography.com/jay-taylor/ Last updated 1st June, 2014. Measure your website readability!
www.alpari.co.uik Page 1 of 1. https://readability-score.com

You might also like