Google Analytics’ Regular Expression support
Those among you who use Google Analytics on a regular basis or at an advanced level almost certainly will have dabbled in utilising Regular Expressions at one point or another – either for setting up advanced filtering on your reporting profiles, or for matching complicated subsets of data within your reports. For those of you who are unfamiliar with these extremely flexible pattern matching tools, you should definitely check them out! There is a fantastic amount of information on what they are and how to use them available across the Internet, and I would recommend sites such as http://www.regular-expressions.info as a good starting point in unlocking an invaluable tool for your Analytics arsenal.
However, for those familiar with the use of RegEx you may also be aware that different software or web technologies can vary in what pattern matching capabilities they provide. Google Analytics’ support for RegEx is no exception to this – with certain features that may be standard to other programs being entirely absent from GA, either for programmatic reasons or simply a lack of any need to support them. In my time working with GA there have been a number of times I’ve tried to match a specific pattern only to find that it doesn’t work, which can be something of a vexing issue when you need to find another way around a problem you might otherwise ‘easily’ solve.
To that end, I’ve spent a little time checking into just what features of RegEx Google Analytics supports, and want to share with you a list of what you can do with them within your reports and filters. I’ve compiled the supported features into a handy Cheat Sheet using the fantastic Cheatography engine developed by my former colleague and ex-Fresh Egg mastermind Dave Child.
You can view the cheat sheet online and download it as a PDF file if you so wish!
Please let me know if you feel there is anything missing, or if you have any RegEx tips and tricks you’d like to share with us!