Live data from Hacker News

Regexper: Beautiful regexp visualizations

regexper.com

31–40 of 132 posts

Re: Regexper: Beautiful regexp visualizations

#31
post #7

I tried the most complicated regular expression in the world: http://ex-parrot.com/~pdw/Mail-RFC822-Address.html and the server 500'd. Just joking, it's a very good tool. P.S. it crashed with three nested groups (((a*)))

One of my co-workers submitted the nested groups issue to github, so I'll definitely look into that one.

I'm also going to look into the RFC822 one as well (even though rendering something that size isn't really a goal). I suspect I might not be handling massive inputs sufficiently and want to make sure to address that.

You're probably lucky it didn't render though...that SVG would be non-trivial...

Re: Regexper: Beautiful regexp visualizations

#33

This website is awesome! Instantly bookmarked. Suggestions 1) it would be really nice if you could allow the user to share a regex with a friend. IE http://www.regexper.com/shared/some_unique_slug will display my saved regex 2) Add a Favicon Great work thanks for creating this

Why not simply the regex itself in the url instead of some unique slug? - No need to store state on the server

Re: Regexper: Beautiful regexp visualizations

#34

but it doesn't show what is matched - as in a example matched string - which is the most important thing also how do you put in the case insensitive flag?

I think this would be quite valuable -- provide a second input for sample text and highlight the path taken. Bonus points for figuring out a way to handle multiple sample inputs, showing capturing group output, etc.

Re: Regexper: Beautiful regexp visualizations

#35

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…

This type of useless comment is why I tend to avoid HN for periods at a time. Congrats, you've shown the world you know what "isomorphic" and "FSA" means, but did you initially bring anything constructive? No. You had to edit in things barely constructive because your impulse was to tear down rather than build up.

> Neither beautiful nor a visualization really.

This is the least helpful thing I can imagine. "Here's a beautiful regex visualizier" "LOL NO IT'S NOT". Geez.

Re: Regexper: Beautiful regexp visualizations

#37

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).

Very cool visualizer!

Re: Regexper: Beautiful regexp visualizations

#38
post #22
post #13

The following valid js regexp gives a server error: ^/([^/]+)[/]?(_((site)?(edit|show|manager))(/|$))?([\s\S]*)

[\s\S]* Doesn't this match every possible character, 0 to infinity times?

It's an idiom for `.*` when you want `.` to mean any character, including newlines. `.` never matches a newline in JS regexes.

Re: Regexper: Beautiful regexp visualizations

#39
Interesting concept. As with all regex related online tools, it is important to test exhaustively before trusting it.

Real-time character-by-character output would be important. If you are working on a long regex expression real-time output can help you think like the FSA and see how it behaves.

Here's an example of this tool failing:

    ([^
http://gskinner.com/RegExr/?339m7

or

http://rubular.com/r/pCXZs0DnSS

take your pick, same results.

If you remove the "?" from the regex you'll get different results.

One version selects all anchor tags individually and make a selection group of their contents and the other version ends-up selecting everything between the first opening anchor tag and the last closing anchor tag into the selection group except for "The graph in Regexper does not show any difference between the two expressions even when any one of these forms is used:

    #([^#msi
    
    #([^#gsi
    
    /([^/msi
    
    /([^/gsi
It looks like the flags are not being processed.

Also, please change the textbox to a fixed width font.

In addition to that, regex authoring tools, ultimately, are only useful if you can also enter some input text and see the result, preferably in real-time.

Other than that, it's an interesting concept.

Re: Regexper: Beautiful regexp visualizations

#40
post #33

This website is awesome! Instantly bookmarked. Suggestions 1) it would be really nice if you could allow the user to share a regex with a friend. IE http://www.regexper.com/shared/some_unique_slug will display my saved regex 2) Add a Favicon Great work thanks for creating this

Why not simply the regex itself in the url instead of some unique slug? - No need to store state on the server

I'd avoid it to prevent url encoding problems.
Post reply on HN