views:

813

answers:

7

Now, I know both SQL and regexes just fine, but a few times on this site, I came across someone working through the exercises on SQLzoo.net. As far as I could tell, this was a wonderful online resource where someone can pretty easily learn SQL by example, writing many toy queries against several toy databases. I will likely redirect people wanting to learn SQL to that site.

These SQLzoo people also run some other tutorials, including some on a few programming languages. However, the section on regular expressions is pretty small (e.g., see Java's page), and I don't think you can actually learn regexes from it. I think a good, online tutorial might help with the onslaught of basic regex questions we have here. (Maybe after the answer, we could suggest that they take a look at the tutorial.)

So, is there a good, online, interactive regex tutorial along the lines of that SQL tutorial? I looked online briefly, but all I could find were non-interactive tutorials or simple pages (still useful, though!) that let you match a string against a pattern so that you could see what it matches/captures/etc.

+5  A: 

I always thought txt2re was a very clever tool. You just type an example of some text you want to match, and then it lets you pick bits out to match against. I'd consider it to be a fairly useful tool for learning regular expressions.

Mike Houston
Yeah, I like the idea, too. It'd be interesting if there were an equivalent for SQL. =)
A. Rex
+1, this tool is great!
G-
I'll accept this answer as the best option available. I'm still disappointed (not at you) that there doesn't seem to be something more like what I wanted.
A. Rex
This tool is awful. The UI makes me die a little.
a paid nerd
I never said it was pretty :)
Mike Houston
+3  A: 

It's not really interactive, but still a good tutorial: www.regular-expressions.info. You could try combining that tutorial with one of the online RegEx tools to try out the examples (for a little interactivity :-)

ISW
+2  A: 

This may also help: Visualize regular expressions simply.

And after you master creating your own, you may want to learn about how they are implemented.

Adam Bernier
+1  A: 

It's not online, however, you might enjoy the game RegexExpress (warning: one of the award pictures is nsfw). It's a game made during a PyWeek contest that teaches you to use regex on a curses type interface. I found it quite fun.

Eugene M
Thanks, I'll take a look.
A. Rex
+1  A: 

There's Regex Hero. It's not a tutorial, but it is interactive. It'll highlight matches as you type. The instant highlighting makes it easy to experiment.

Steve Wortham
A: 

interactive regex builder

runrunraygun
A: 

HiFi Regex Tester

Regular expressions can be a pain. This tool is designed to help developers learn, practice, and compose regular expressions.

Although this tool is not quite a tutorial in the style of that SQL website, its intention is to help teach regex.

Ray Vega