More Resources

Note on Regular Expression Characters

It is important to point out that the regular expression features that are supported by Qualaroo depend on those supported by JavaScript. Consequently, these regular expression features are not supported by Qualaroo:

  • s (single-line mode) and x (extended syntax) flag

  • \a \e \l \u \L \U \E \Q \A \Z \z \G escape sequences

  • (?<= ) positive look-behind anchor and the (?<! ) negative look-behind anchor

  • (?# ) comment and the other extended (? ) syntaxes.

Regular Expression Testing

There are a few tools out there that let you test your regular expressions and see if the URLs you want are matched. The one we use most frequently is and it's free, provides lots of explanation for each part of the regular expression, and has a field where you can test out sample URLs to make sure they match or don't match.

At the bottom of that site is a grid of the most common regex characters. Don't be afraid to check it if you're not sure about something! There's a few more listed than what is in this guide, but their meanings aren't too difficult to understand. They also have a "complete reference" portion - most of this is targeted at programmers and while these characters can be used in your URL regular expression, most of then won't be relevant.

Another great tool is It is very similar to, but it allows you to test multiple URLs against your regex at the same time. Efficiency!

Regular Expressions for Google Analytics


There is a fantastic ebook put out by LunaMetrics on Regular Expressions for Google Analytics. It goes over the basics of regular expressions, and how to apply them to Google Analytics. The is the URL for the PDF form of the book:

Lookaheads and Lookbehinds

This page goes further in depth on lookaheads and lookbehinds: In general, it's a really awesome regex tutorial site.

Forging Bravely into the Great Unknown

Google Search

As in most things, Google is Your Friend. However, Google is particularly difficult to use for help with regexes because it specifically excludes punctuation from search results. You know, things like .*, (?! ), \/, all that good stuff that makes regular expressions possible. A workaround is to preface every search with "regex" and use words to describe what you want to do. It's not the best solution, but until some whiz kid invents a new kind of serch engine, this is what we have.

Stack Overflow is a great resource for all things programming - you ask questions, other random programmer-type people on the internet help you out. Sometimes they aren't very friendly, sometimes they're awesome, sometimes they're awesome and nice but totally wrong! This is why you should always check a few different places to make sure they have the same answer, and always test your regex before it goes live. A lot of people have asked a lot of questions though, and oftentimes, these threads are what will come up in your searches.

All Fun and No Play

If you feel like you need a little more practive before you're ready to start making these on your own, play around with They have a series of crossword-style puzzles, increasing in difficulty, that will help you get comfortable with the regex characters and combinations. The puzzles are also a little nerdy, so you may end up wanting re-read Hitchhiker's Guide To The Galaxy by the time you're through.

Bits and Pieces

Here's some pieces of URLs in regex form that might come in handy. On the internet, copying this kind of thing isn't considered stealing - it's just more efficient! If you don't believe us, ask one of your engineers :)

https?:\/\/(www\.)? - Start any URL with http(s)://(www.)

[a-zA-Z]{2} - Exactly 2 letters (great for /EN, /fr, /No and other 2-letter language modifiers)

.*(\.[Jj][Pp][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg]|\.[Pp][Nn][Gg]) - Will match any .jpg, .gif, .jpeg or .png image file, capital or lower case

Qualaroo Support

If you get lost at any point or want help troubleshooting your regex, drop the Qualaroo Customer Success Team a line. We're here to help you out! We hope you enjoyed this guide, and feel comfortable writing your own regular expressions now. You can do it!



Back to the beginning

Have more questions? Submit a request
Powered by Zendesk