Live data from Hacker News

Regexper: Beautiful regexp visualizations

regexper.com

51–60 of 132 posts

Re: Regexper: Beautiful regexp visualizations

#51
post #47

Hello, I'm the creator of this (trevmex is one of my co-workers). I just want to thank everyone for the feedback so far, I am looking into the issues that have been brought up (they'll have to wait until this evening to be fixed though...I have a day job).

Neat tool, I like how clear the visualizations are. It didn't work for me under Chrome on OSX, though. Chrome Version 23.0.1271.101, OSX 10.7.5.

Works for me, Chrome 25.0.1364.5 dev, OS X 10.8.2. Maybe it's a stable version bug.

Re: Regexper: Beautiful regexp visualizations

#52
Chokes with a "Server error" on the following URL validator:

\b(?:((?:https?|mailto|s?ftp): )(?:\/{1,3} |[a-z0-9%]) |w{2,3}\d{0,3}[.]|[a-z0-9\.\-]{1,40}[.][a-z]{2,4}\/)(?: \&[a-z]{2,8}\; | [\w\(\)\.\/\:\@\#\?\=\&\-\!\~\;\'\[\]] | \%[0-9]{2})+

This is after changing ?> to ?: since it doesn't understand the non-backtracking syntax.

Re: Regexper: Beautiful regexp visualizations

#53

Neither beautiful nor a visualization really. For the uninitiated, there's an isomorphic relationship between regular expressions (not PCREs which are way more complicated) and finite state automata proving that if you have a regexp you can generate a FSA for it, and visa versa. What we have here is a system that generates a graph of the finite state automaton for any given regular expression. Neat project, misleadin…

For those interested in this, look up Thompson's Algorithm (http://en.wikipedia.org/w/index.php?title=Thompson%27s_const...).

Re: Regexper: Beautiful regexp visualizations

#54

This is great. Has this approach to visualizing loops and structures been tried with general programs? Indentation and color coding seems to be the limit to the visual expressiveness in most IDEs because they tend to stay withing the format of plain text files. I'd really like to see some more creative visuals like this for making program structure visible.

I don't know if there's a name for this style of display, but it's the same as the way JSON is depicted on its official site. http://www.json.org Edit: It's called a Railroad Diagram.

No, it's called a finite state machine ;)

Re: Regexper: Beautiful regexp visualizations

#55
OK I'm missing something...if this post wasn't labeled "Beautiful regexp visualizations" I don't know if I would've poked around for more than a couple minutes (and I love regexes)...perhaps the opening screen should by default have one of the more appealing examples? I hadn't known that I had to hit "Enter" for anything to happen...I still don't know what I'm supposed to be seeing, though I'll support anything that makes regexes more accessible.

Re: Regexper: Beautiful regexp visualizations

#57

Hello, I'm the creator of this (trevmex is one of my co-workers). I just want to thank everyone for the feedback so far, I am looking into the issues that have been brought up (they'll have to wait until this evening to be fixed though...I have a day job).

You should build a tool that is the inverse of this. Let people build regular expressions by creating the visual diagram (some sort of click and drag GUI).

Re: Regexper: Beautiful regexp visualizations

#58
post #54

Earlier quoted context omitted.

I don't know if there's a name for this style of display, but it's the same as the way JSON is depicted on its official site. http://www.json.org Edit: It's called a Railroad Diagram.

No, it's called a finite state machine ;)

The FSM is the model, the Railroad Diagram is the view, to borrow terms.

Re: Regexper: Beautiful regexp visualizations

#59
Its beautiful to see the "check if number is a prime" regex as a diagram:

    ^1?$|^(11+?)\1+$
I noticed two glitches:

1) It gives me the same output image for these two different regexes:

    ^[a-x]*yo$
    ^[a-x]+yo$
2) It gives me a server error for this:

    a(b*(c*(d*)*)*)
Edit: I was wrong about glitch 1. See below.

Re: Regexper: Beautiful regexp visualizations

#60
post #26
post #6

Useful. Thanks to this, found a bug in regex I did just today. `/[^0-9^\+]+/` -> `/[^0-9\+]+/` # Thought that I needed to negate "+" as well.

You typically don't need to escape a + inside a character class, either, so /[^0-9+]+/ should work.

Thanks! :)
Post reply on HN