Regular Expressions Part I: Escaping with a Backslash


What are Google Analytics’ “Regular” Expressions?

This was the question that I asked in August 2006. Although this post is ostensibly from August, I am actually rewriting it in October. Now that I understand Regular Expressions for Google Analytics, I want to explain them in the easiest language possible (so I had to go back and rewrite.)


The most basic expression is the backslash. Google Analytics ascribes this meaning to it:

escape any of the above

What they mean is, you can use a backslash to turn any special character into a not-so-special character. Google (and everyone else who talks about Regular Expressions) makes this hard by using the word “escape,” when they merely mean, use a backslash to take the magic out of a special character and make it an everyday character.

Although the backslash can be used with any special character, I see it used most often with a dot. This is because a dot is both a special character (see Part II), and one that is used with the Internet all the time (Example: — we see it there twice.) On the Internet (and so, with Google Analytics) we almost always are using dots as regular dots and so need a backslash to keep it as a mere dot. Here’s an example: and here’s another one (this time, an IP address):

Many thanks to my tutor in Australia, Steve. With his help, help from Justin Cutroni, and many hours of reading and rereading the Wikipedia page on Regular Expressions (I won’t even link there, it is so difficult), I learned Regular Expressions. Very late comment: This started as a mere question for me. This ended with a seventeen part series.

Dots .
Carats ^
Dollars signs $
Question marks ?
Pipes |
Parentheses ()
Square brackets []and dashes –
Plus signs +
Stars *
Regular Expressions for Google Analytics: Now let’s Practice
Bad Greed
RegEx and Good Greed
Minimal Matching

Robbin Steif

Our founder, Robbin Steif, started LunaMetrics in 2004. She is a graduate of Harvard College and the Harvard Business School, and has served on the Board of Directors for the Digital Analytics Association. Robbin is a winner of a BusinessWomen First award, as well as a Diamond Award for business leadership. In 2017, Robbin sold her company to HS2 Solutions and has since retired from LunaMetrics.

Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187