Translate

Friday, January 25, 2013

Regular Expression Tester

I "regularly"  (nyuk nyuk!) use regular expressions in my .Net code.  However, I find that I spend no small amount of time designing them, troubleshooting why they aren't working and trying to work out the escape characters correctly.  So much so that I decided to write a Regex testing application.

Regex Tester (zipped .exe)

C# Source Code

This tool allows me to rapidly test regular expressions against sample text with or without options.


It shows me matches, splits and replaced text.

If the Regex phrase is invalid, it will display the error text:



When I'm satisfied with the phrase and options, I click Copy Regex Initializer to copy it to the clipboard:


I can paste the copied text directly into my code after declaring the Regex object:

I hope you find it useful.


1 comment:

kevinthenerd said...

Nice!

I write a lot of REGEX'es in Oracle Database. I'm spoiled by the direct execution by the database because testing is just a matter of opening a SQL editor...

SELECT REGEXP_REPLACE('ORDER_NO=foo^LINE_NO=bar^', '^[A-Z_]*=([^^]*)\^[A-Z_]*=([^^]*)\^$', '\1 \2') FROM DUAL;