42 comments

[ 2.4 ms ] story [ 68.2 ms ] thread
Would be great if there were support for more Regex types. All those supported by grep (ie. BRE, PRE, PCRE) seem fairly essential – and being a Python guy, Python would be nice too (which are PCRE-ish).

Nice work, though.

(comment deleted)
I will second a Python vote.
More contrast, please. I can barely see the green matches on my screen.
Nice work! :)

http://rubular.com is also a good one (Ruby regexes).

Rubular is great - I like their UI better than the one of the [js|re]Fiddle[s]?.
Perhaps you mean:

    (js|re)?Fiddles?
I don't know, I'm pretty fond of |Fiddle myself ;)
I'll go ahead and recommend RegexBuddy (http://www.regexbuddy.com/) as another useful tool for testing regexes. (No affiliation, this just happens to be one of the most useful programs I've bought with my own money.)
I was gonna recommend this as well, then I saw your comment, and then I saw your username, and then it got really weird.
Don't you hate it when you make a comment through an old HN account and then completely forget about it and post through your normal HN account a quarter of an hour later?
RegexBuddy is fantastic, I bought it ages ago and lost my license key thing. Also it's Windows only (boo!).
Regexbuddy was critical for success on three Regex heavy projects I worked on a few years ago. I still have it running on an old Windows PC.
If you are looking for a command line regexp builder I highly recommend txt2regex. It is a giant bash script so it runs anywhere bash does and supports:

  a) +awk                                m) +mysql 
  b) +ed                                 n) +ooo 
  c) +egrep                              o) +perl 
  d) +emacs                              p) +php 
  e) +expect                             q) +postgres 
  f) +find                               r) +procmail 
  g) +gawk                               s) +python 
  h) +grep                               t) +sed 
  i) +javascript                         u) +tcl 
  j) +lex                                v) +vbscript 
  k) +lisp                               w) +vi 
  l) +mawk                               x) +vim 

http://aurelio.net/txt2regex/
My entry into this category:

http://regex.powertoy.org/

It makes use of a hidden Java applet -- so it supports the somewhat larger Java regex syntax, doesn't send your data anywhere else for matching, and can hook into the string-probing to animate the process. (Click the 'animate?' link to show the animation step/speed controls.)

For example, you can watch the regex that tests whether a number is prime (by failing) or composite (by succeeding) via these two animations:

49: http://regex.powertoy.org/?pat=/^1%3F%24|^%2811+%3F%29\1+%24...

47: http://regex.powertoy.org/?pat=/^1%3F%24|^%2811+%3F%29\1+%24...

Is the applet requirement a deal-breaker for casual use? I might be able to feed the OpenJDK 7 regex classes through the Google Java->JS cross-compiler to get a pure-JS solution with the same syntax/animation capabilities.

I don't think its a deal breaker but if its a hidden java applet then why not have the regexes processed on the server as a servlet and sandbox them with a timeout?
That could work, but an original design goal was to avoid server dependencies or bottlenecks.

For instant display or the stepwise animation, the lag of a server roundtrip could be a problem; for some users, posting data to a remote service might introduce privacy concerns. (The regex-powertoy can be run completely locally.)

well. for some it is because they don't run java (e.g. me) but for the large population it will not matter.
Cool! Is the code open source?
I use sublime text for this. Considering how many regexes I write a day, I actually need a text editor that has this support. Don't you ? :)
No. Regexes are a hack. I don't write them every day, I write them when I need a hack to get around a problem there isn't a good solution for.
Why do you say regex's are hacks? Aren't they nice to use in order to search and replace text? It's really powerful!
Regexs are not hacks. They are part of a programmers toolchest. Just because you write them when you cannot think of a better solution doesn't make them a hack.

They are a legitimate solution for efficient text matching problems.

Some other online regex tools that you may find useful depending you what flavour of regex you want to create and how proficient you are with them:

http://www.rexv.org/ — Supports: PCRE, Posix, Perl, Python, JS, Node.js modifiers. Only works online though.

http://gskinner.com/RegExr/ — Implemented in Flash. Desktop version available.

http://regexpal.com/ — Javascript regex only.

I've used lots of regex tools over the years, but I stopped looking once I bought RegexBuddy.

See a demo: http://www.regexbuddy.com/demotest.html

It's a Windows program, but runs on Linux via WINE. It lets you debug regexes, has live highlighting of matched text, generates regex code in 15+ languages (Perl, Python, Ruby, PHP, C, C#, C++, Delphi, Java, Javascript, MySQL, etc) and is all around awesome.

I'm not affiliated with this program, but it is the BEST regex creation/testing program available anywhere.

It will save you oodles of time if you create (or debug) regular expressions more than 2 times in a year. It's the best software product I've ever bought with my own money.

Very nice, please add Java and Python support, but otherwise really dig it.. the tests are especially neat.
Nice work! It sure do got a purty mouth.
I too have a website that does regex testing. It supports Java, JavaScript, .Net, Perl, PHP, Python, Ruby & XRegExp, though some are more complete than others.

And it supports sharing & a cookbook too.

http://www.regexplanet.com/

This regex creator is one I've used for ages; its a bit ugly but it generates the regex for Perl PHP Python Java Javascript ColdFusion C C++ Ruby VB VBScript J#.net C#.net C++.net VB.net. You type an example (or the actual) string you plan to search over, click submit and it generates a weird chart that you can use to select which bits you want your regex to find. Really advise giving it ago; no regex knowledge required and more importantly.. fast.