What are Regular Expressions and how do I use them?

Regular Expressions, also known as RegEx, are a way to use characters—such as | and \—to make analytics magic happen. But, more specifically, they are used to do things like create custom filters and goals in Google Analytics. Confused already? Don't stress. We are about to break it down for you.

The Basics of Regular Expressions

RegEx operates on a set of very strict rules. Much like a programming language, each symbol and combination of symbols must be correct in order for the expression to work. Unlike some of the more inexact sciences of website analytics, RegEx is very precise.    

Let's look at one of the symbols we listed above, |. Known as the pipe symbol, | is used to symbolize or. So, if you want to create a filter that gives you results for attorney or lawyer, you would use attorney|lawyer. Easy, right? Right. And while this is just one of the many symbols—and combinations of symbols—it's a start. If you keep at it, you'll soon understand the entire RegEx language and be using like a pro. 

But Why Bother Learning Regular Expressions?

While there are numerous SEO optimization tools, we believe that knowledge of RegEx is an excellent addition to your SEO tool box. Even for an analytics newbie like yourself, Regular Expressions can be very useful. To show you how, we will give an example.

Let's say you want to hit all variations of your targeted keyword. This is a great idea because creating these filters will give you a good idea if your targeted keyword—Divorce Attorney Layton, UT—is bringing you much traffic. But filtering for all the variations of this phrase would require creating filters for Utah, UT, Layton, divorce, attorney, and attorneys.   

However, if you use RegEx, you will be able to create just one filter: “Layton UT Utah Divorce Attorneys. divorce attorneys?|divorce lawyers?”  and, on a second line, which indicates the “and” expression to include, “Layton UT|Layton Utah”.

Regular Expressions give you the power to become more involved in the analytics of your website. And, besides, using RegEx is just plain cool. Think of how clever you'll feel when you know the difference between | and \. And, as a bonus, you'll be able to tell fantastic techie jokes like, "/Everybody stand back/ I know regular expressions." Hilarious!

Plus, there are some tasks that Google simply won't let you do without using RegEx. So, if you want to perform even mid-level analytics tasks, you must be familiar with RegEx.

Want to learn more about Regular Expressions? Or do you wish you could forever erase the memory of RegEx from your mind? Either way, call 888.886.0939. We can take over your analytics efforts or help you get a firm grip on this awesome analytics tool. No matter what you decide, our killer attorney SEO team can help you achieve your web marketing goals and dominate the competition.