Test Regular Expressions in Your Browser

After you have created a regular expression, you usually write a script or use a tool to test if the Regex works as expected. Alternatively, if you are using Firefox or Google Chrome, then here are some plug-ins that make it very simple to test regular expression directly from your browser. I had recently written a post on Validate US Zip Code using JavaScript where I had used the Regex ^[0-9]{5}(?:-[0-9]{4})?$ We will use the same regex for this post and test it using the add-ons for Firefox and Chrome.

Regular Expressions Tester 3.0

This is a Firefox add-on for regular expressions with color highlighting (including submatches) and helpers for creating expressions. Observe in the screenshot shown below how the color changes to yellow as soon as the Regex matches a valid US zip code.


Regular Expression Checker

This is a simple add-on for Google Chrome and is inspired by Regular Expressions Tester 3.0. You can save a regular expression and the tool also shows the number of matches, sub patterns etc. The only thing that I was not comfortable with was that this tool wanted access to my browser history to work properly. Now I am not sure why was that required. Nevertheless, here’s a screenshot of the results after testing my Regex.


I could not find any add-ons for Internet Explorer that can test Regular Expressions. If you know of any such add-on, let me know and I will add it to this list.

Will you give this article a +1 ? Thanks in advance

About The Author

Suprotim Agarwal
Suprotim Agarwal, ASP.NET Architecture MVP (Microsoft Most Valuable Professional) works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He is the Editor of a Developer Magazine called DNC Magazine. He has also written two EBooks 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook

Follow him on twitter @suprotimagarwal

1 comment:

Christian Harms said...

Why installing an extra plugin if this is build in JavaScript?

Open your javascript console an type: