Thursday, January 10, 2013

Regular Expressions on Google Analytics - Easy Tutorial

Regular Expressions are applied on Google Analytics to match specific pattern of information in order to filter and present the most useful data. These regular expressions are extremely useful in filtering out specific pieces of information among the large data collected and stored in Google Analytics.

Given below are a collection of regular expressions which you can use on Google Analytics:- 

Asterisk (*)

Regular Expressions
Regular Expressions (Image credit:- codeinsect)
Use asterisk to match single character or a number of characters appearing before or in place of the asterisk. 


You want to search for "SEO25tutorial" but you have forgetten the number. You only remember "SEO" and "tutorial". In this example, you may use the asterisk as given below:- 


This would display the exact match and fetch you the result "SEO25tutorial"

Logical OR ( | )

The pipe symbol is used to represent logical OR. It is used with paranthesis to fetch the desired results.



The above expression would fetch either Google Plus or Google Play

Backslash (\)

Used to turn any special character into a literal character.



Here, we have used \ just before . which is a special character.

Square Brackets ([ ])

Used to filter information that matches any single item in the list contained in the square brackets.


[123456] or [1-6]

This would match either 1 or 2 or 3 or 4 or 5 or 6.

Dollar Sign ($)

Used to match the end of the field.



This would fetch all the news1.htm pages contained under the seonews folder.

Plus Sign (+)

Used to filter information that matches one or more of the previous items.



This would fetch all the matching information like seonews, seoworldnews, seopronews etc.

Question Mark (?)

Used to match zero or the previous expression.



This would fetch sandwitch (matching the previous expression) and sandwich (matching zero i.e. no't' is included)

Test Your Regular Expressions

After you have created your regular expressions as per your needs, you may test it using the tool given below:- 

Also See:- 

Post a Comment