Live data from Hacker News

Regexper: Beautiful regexp visualizations

regexper.com

61–70 of 132 posts

Re: Regexper: Beautiful regexp visualizations

#61
post #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.

>Gives me the same output image for these two different regexes:

> ^[a-x]* yo$

> ^[a-x]+yo$

No, it does not.

When you do (something)* , pay attention to the additional path that is created that circumvents the (something) box. With (something)+, there is no such path.

Re: Regexper: Beautiful regexp visualizations

#62
post #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.

>Gives me the same output image for these two different regexes: > ^[a-x]* yo$ > ^[a-x]+yo$ No, it does not. When you do (something)* , pay attention to the additional path that is created that circumvents the (something) box. With (something)+, there is no such path.

Aaaahh! Yes! Awesome!

Re: Regexper: Beautiful regexp visualizations

#63
post #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).

I've always wondered why there doesn't already exist such a tool. Regex strings are so opaque and hard to read. We can't really fix that for code (short of building objects), but what we could fix is a better way to write them.

A graphical tool to create them, built of units instead of just strings, and the output could still be a regex string.

Re: Regexper: Beautiful regexp visualizations

#64
post #41

Just a thought- on the page if the author showed a few example regexes that would be really useful. Rubular does a great job of having a 'key' at the bottom, so I don't have to remember (or look up) anything.

This is a good point. Also mentioning which flavour of regexp is supported would be nice.

Re: Regexper: Beautiful regexp visualizations

#65
Hey, this is really cool, and a great visual language for regular expressions! Must have been fun to build.

I found a couple of bugs: it doesn't seem to handle `?>` and inline modifiers (http://www.regular-expressions.info/modifiers.html), and with a couple of expressions it simply gave me a server error with no further information.

Re: Regexper: Beautiful regexp visualizations

#67

It would be gorgeous if upon clicking enter you'd be redirected to an URL that you could share with someone. Even better: make it directly a "tiny" URL. I realize that then some kind of a database would be needed but it would be really sweet.

Or, you know, a good old query string.

Re: Regexper: Beautiful regexp visualizations

#68

It would be gorgeous if upon clicking enter you'd be redirected to an URL that you could share with someone. Even better: make it directly a "tiny" URL. I realize that then some kind of a database would be needed but it would be really sweet.

The URL could simply include the regexp encoded in a path component or query string. No need for a URL database.

Re: Regexper: Beautiful regexp visualizations

#70
very nice! makes me wonder, would it be helpful to have a natural english style language to express regular expressions in? Since the diagrams say "one of" and things like that, it makes it so much clearer. Maybe a library that let you say the same things would help too, since I think the ultra-hieroglyphics are part of what makes regex so confusing. Nothing very ambitious, just changing dots and stars and weird parentheticals to english words so when you read a regular expression, it reads more like the output of this site, which is nice.
Post reply on HN