Cool Tools: Regular Expression Tester

October 2, 2014 Alan Feuerlein

screenshot of a Javascript Regex Testing Page

Regular expressions can be hard to understand, even for the most seasoned propellerhead. I initially wrote this tool to help myself. The concept is simple – paste in a block of text and write a regular expression to see what matches. I’ve released the tool and hope you find it useful tool. Find it at http://regex.observepoint.com.

What is a regular expression?

Regular expressions (regex) are strings of characters that, when combined, form a very specific and powerful search pattern. At ObservePoint, we use regex as part of data validation methods, including detecting tags on the web. We use regex to match varied requests but group them as under the same tag type. Along with matching, regular expressions also allow us to extract data from requests, including variables, accounts, versions, and more. Regular expressions are used every day here at ObservePoint, both internally and by our customers. Though they can be complex, they are a useful tool for matching text data.

Many analytics tools support regular expressions in a variety of ways. A common use case is as a data filter, when a more simple include/exclude type of filter is not powerful enough. For example, you may want to filter on a product variable, looking for shirts or sweaters. In this case, the following regular expression would be useful:

(shirt|sweater)

The pipe (|) character in the aforementioned is saying, match ‘shirt’ OR ‘sweater’. If we tweaked the previous slightly, we come up with something even more powerful:

summer-(shirt|sweater)

Now we are matching some input on something with summer, but followed by shirt or sweater. So ‘summer-shirt’ OR ‘summer-sweater’. You can see this example tested and working in the tool here: http://goo.gl/LrCd76

Regular expressions are a powerful tool for both programming and search. For more information on regular expressions, including their use, syntax, etc., see this helpful Google Analytics resource: https://support.google.com/analytics/answer/1034324?hl=en&ref_topic=1034375

 

About the Author

Alan Feuerlein

Alan is an innovative software developer and leader who is passionate about Big Data and digital marketing. Originally from Cincinnati, Ohio, Alan now lives in Orem, Utah and has worked in developing software since 2009. He's spent 6+ years in the web analytics industry in data verification and has worked aggressively to resolve poor data quality. Because of the many issues he has encountered in the digital world, he often refers to the internet as “The Wild West.”

LinkedIn More Content by Alan Feuerlein
Previous Article
Improving Digital Data Quality with Auditing and Governance
Improving Digital Data Quality with Auditing and Governance

This article explains why tag auditing is an important first step in tag management and in defining a compr...

Next Article
Deploy a Data Governance Solution to Test Your Analytics Tags
Deploy a Data Governance Solution to Test Your Analytics Tags

This article outlines why an auditing solution is necessary to gaining accurate, trustworthy data. See the ...

×

Subscribe to the Blog

Thank you!
Error - something went wrong!