Upcoming LunaMetrics Seminars
Boston, Oct 6-10 Chicago, Oct 20-24 Seattle, Nov 3-7 New York City, Nov 17-21

TOOL: The Regexinator, A Google Analytics RegEx Include Filter Compiler

The Regexinator is a simple tool that concatenates large amounts of data with pipes and escape character expressions. You can paste your data in the text area in rows or as comma separated values. Once you’ve clicked ‘Regexinate!’, it will return those values as a regular expression, with the aforementioned formatting. You can also specify if you want each term to be exactly matched by checking the ‘Exact Match’ box below the text area.

Back in December, I released the first version of the Regexinator as an Excel spreadsheet. I made the tool because I found myself frequently needing to quickly roll up and compare pages that lacked common taxonomy inside Google Analytics. Let’s take a look at an example; now, for sake of brevity, let’s limit our actual example to three products, but in our imaginations, let’s pretend that you had, say, 120 similarly unstructured product pages and you wanted to look at and compare them all in the same report. We’ll use these three product pages for our example:

  • Red Hat 1 (example.com/redhat1)
  • Red Shirt 1 (example.com/holiday/shirts/redshirt1)
  • Maroon Pants 21(example.com/pants/maroonpants21)

After getting the URIs into a table or comma separated list, you would copy and paste them into the Regexinator and click Regexinate!. The Regexinator gobs all of those URIs (or terms) together, escapes each input to avoid any accidental RegEx, and then makes the string exact match (if you so please) The resulting filter would look like this:


Then, you can paste that super long expression into an advanced segment or filter and see all those pages rolled up and make comparisons on a page-by-page basis (note: I’m told there are character limits for filters and advanced segments that occur around 1600 characters, but I was unable to determine a specific breaking point when I tested). If you’re a regexp impresario, this is probably not the solution you would prefer. Seriously, this thing is not at all graceful; if it were a product, it’d be the kind that Billy Mayes would breathlessly scream at you about at two in the morning.

Although this method is more brute force than finesse, I found it helpful, and so did some of you. Justin Cutroni (Let’s see if his Google Alerts are working) pointed out it would make a nice web app; so, here we are. It’s certainly not the prettiest Javascript at the fair, but it gets the job done.

But wait, there’s more!

Did you find this helpful, or do you think it needs additional functionality? Let me know in the comments.


5 Responses to “TOOL: The Regexinator, A Google Analytics RegEx Include Filter Compiler”

Bjoern Wein says:

I like the general idea a lot to turn data into regular expressions – but as you’ve pointed out, it’s a very brute force approach that is used here :)

I just typed in 1,2,3,4,5,6,7,8,9,10 and of course it would be nice in a future version of the regexinator to have some first logic examining the data and then deciding what regex structure to use.

But thank you for the general idea and pushing this forward – I would be happy to pay for the advanced functionality, e.g. as a Google Analytics plugin or Browser plugin that could pickup data from tables inside GA.

Hey Bjoern,

Thanks for the feedback :) Eventually, I might take a stab at ‘beautifying’ the Regexinator with some logic like you described. But for now…


Tom says:

One piece of functionality that would be useful is if it split the code up into 250 character strings. Great work!

Hey Tom,

Just out of curiosity, why do you need those 250 character snippets?


Mathias says:

@Dan I’m just guessing here but I think Tom wants the 255 limit because filters in G.A like IP address exclusions are limited to 255 characters in length.