Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Gemfile
Gemfile.lock
Rakefile
Readme.md
regex_playground.gemspec

Readme.md

regex_playground

Warning open-source warriors: this code is a spike, not really useful yet.

A compiler that turns (a small subset of) regular expressions into finite state machines (FSM). And for now it just shows them as visual graphs for you to enjoy!

This is an excuse to play around with different regular expression implementation algorithms and learn about them without having to code the whole thing in C. Of course, a real implementation would need to be really low level to be useful.

Install

$ brew install graphviz
$ git clone git://github.com/txus/regex_playground
$ cd regex_playground
$ bundle install && rake

Current status

For now it just understands terminals such as "a", "b", "28" or "9{yfooabr", and the special character "+".

So as an example, the following regexen can be compiled:

abc
ab+c
aaabbb+
metherfeck+er

It's hacky just yet, very WIP.

Examples

GraphViz example for the regex ab+c:

ab+c

Who's talking?

This was made by Josep M. Bach (Txus) under the MIT license. I'm @txustice on twitter (where you should probably follow me!).

Something went wrong with that request. Please try again.