Regular Expressions Part I: Escaping with a Backslash

By /

August 13, 2006

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.)

regular-expressions

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: www.myspace.com — 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: mysite.com and here’s another one (this time, an IP address): 64.68.82.164

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.

Backslashes
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
{Braces}
Minimal Matching
Lookahead

Robbin Steif

Our owner and CEO, Robbin Steif, started LunaMetrics ten years ago. 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 recent Diamond Award for business leadership. You should read her letter before you decide to work with us.

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.