views:

112

answers:

9

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.

+1  A: 

My mind and PowerShell for testing, mostly:

PS Home:\> $re = '([!?])\1+'
PS Home:\> 'hi!!!!','Hm','foobar??' | %{ $_ -match $re }
True
False
True
Joey
+1  A: 

For me, I use Python to test regex for most cases and javscript shell sometimes.

S.Mark
A: 

I use irb.

DigitalRoss
A: 

Regulator or tkcon.

bassfriend
+1  A: 

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 ;-)

Huppie
A: 

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/'
Chris Lutz
Nah, Perl is *so* last millenium :-)
Joey
Hey! Perl 6 will be released theoretically!
Chris Lutz
A: 

grep at the most basic level, awk for more complex processing.

Sahasranaman MS
+1  A: 

I can think of 2 problems with this approach:

  1. Not all tools use regular expressions in the same way. So you have to select the dialect that is supported by the tool targeted.

  2. 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.

Chen Levy
@1: RegexBuddy fixes that problem by simply supporting just about every possible Regular Expression flavour.
Huppie
A: 

I like this one: http://regex.larsolavtorvik.com/

Useful for PHP and Javascript as well.

Erlock