Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 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.