Possible Duplicate:
Regex Testing Tools
What sorts of tools do other programmers use when creating regular expressions?
I use The Regex Coach but it is sometimes a little slow when dealing with larger expressions.
Possible Duplicate:
Regex Testing Tools
What sorts of tools do other programmers use when creating regular expressions?
I use The Regex Coach but it is sometimes a little slow when dealing with larger expressions.
My mind and PowerShell for testing, mostly:
PS Home:\> $re = '([!?])\1+'
PS Home:\> 'hi!!!!','Hm','foobar??' | %{ $_ -match $re }
True
False
True
For me, I use Python to test regex for most cases and javscript shell sometimes.
Regex Buddy of course!
It supports just about every possible flavour of Regular Expressions, including .NET, Perl, PCRE, JavaScript, POSIX BRE etc. Which is usually the hardest part (My problem is usually to find out how to formulate this regular expression in such a way that JavaScript understands it).
The best thing is that it can immediately output the code for your specific language. Since I'm a bit lazy that comes in handy ;-)
I see Ruby and Python answers, so I'll chip in. Does no one do it old school anymore?
$ perl -pe 'print if /test regex/'
I can think of 2 problems with this approach:
Not all tools use regular expressions in the same way. So you have to select the dialect that is supported by the tool targeted.
Regular expressions are typically harder to read then to write. So you should go with the simplest thing that does the job, and comment it to convey your intentions.
That in mind, the best way is to play with the target tool, and not to rely to a wizard of some sort.
I like this one: http://regex.larsolavtorvik.com/
Useful for PHP and Javascript as well.