Live data from Hacker News

Regexper – Regular expressions visualizer

regexper.com

31–40 of 108 posts

Re: Regexper – Regular expressions visualizer

#31
post #25
post #16

The Email::Valid Perl distribution ships with a more than 6000 character regex to validate E-Mail addresses. Both goo.gl and bit.ly refused to shorten it, and when I tried to paste the link here HN refused to accept my comment. But on a machine with Email::Valid installed do: perl -MEmail::Valid -wE 'say $Email::Valid::RFC822PAT' And copy the output into the Regexper form. It takes a while to render, but it'll eventu…

>Both goo.gl and bit.ly refused to shorten it, and when I tried to paste the link here HN refused to accept my comment. github gist?

Try this: https://gist.github.com/shakna-israel/83b84cd8465d131f968690...

Re: Regexper – Regular expressions visualizer

#33
I love the graphics. I would like the equivalent for Python and the GNU flex (lexer) RE's.

No... wait.... I know what I want! I want a sphinx extension that allows me to include an RE in a Python docstring and have it render as a railroad track graphic in the generated documentation:

  some_re_string = r'ab[0-9]*z'
  """:regex: Any string starting whith 'ab', followed by 
      digits, ending with 'z'.
  """
That should be able to go pick up the documented string and render a railroad track diagram along with the text in the generated documentation.

Re: Regexper – Regular expressions visualizer

#35
post #27

Earlier quoted context omitted.

That is cool. https://www.debuggex.com/ has nice visualization.

Wow, that is really cool. I actually started typing in random characters and tracing the matches through the graph for the Regex from StackOverflow mentioned earlier. I didn't know what the regex matches, so I played it like a game , trying to reach the finish by typing one character at a time. When I finished, I saw that I had typed "01/31/1691" and then realised that it's a regex for dates.

Sounds like you'd love https://regexcrossword.com/

Re: Regexper – Regular expressions visualizer

#36
I'd love to have it the other way around. Human speech to RegExp.I find it really hard to write these expression, e. g.: A colleague needed to write a RegExp for a nickname alias for a URL. It had to have only letters and numbers or a specific number. So either name34 na34me or 23 would be valid.

Re: Regexper – Regular expressions visualizer

#37
After 20 years of software development I‘ve come to adopt a best practise:

Whenever I start writing a regular expression, I stop and write a „manual“ domain specific parse function instead.

Saved me a LOT of debugging time.

Since I can now use kotlin pretty much anywhere (jvm, browser, shellscripts) this is easy because of the superb stdlib („startsWith“, „lastIndexOf“, „substringBeforeLast(...)“)

The time saved I invest in Unittests for the parser.

Re: Regexper – Regular expressions visualizer

#39
post #37

After 20 years of software development I‘ve come to adopt a best practise: Whenever I start writing a regular expression, I stop and write a „manual“ domain specific parse function instead. Saved me a LOT of debugging time. Since I can now use kotlin pretty much anywhere (jvm, browser, shellscripts) this is easy because of the superb stdlib („startsWith“, „lastIndexOf“, „substringBeforeLast(...)“) The time saved I in…

Yep. I primarily use Go, so you are often forced down this way because it uses a simpler regex engine. I used to complain but in hindsight I realized it was a blessing in disguise. Particularly in Go's case, it has excellent character set library support, especially unicode, so those really tricky corner cases with unicode characters are non-existent now as well. I will be happy if I never see a regex with a unicode range again.

Re: Regexper – Regular expressions visualizer

#40
It's always neat to see where one's ideas go! AFAIK, I was the first person to create dynamic railroad diagrams for regular expressions (maybe 12 or 13 years ago). I got the idea from json.org, which I think was Douglas Crockford's brainchild.

My initial implementation was strfriend.com (in Lisp: well under 1,000 lines, including views), and I think its main claim to fame was that Jeff Atwood made fun of it on Twitter. (I was truly clueless at promoting myself back then. Not only did I not have a Twitter account, but it didn't occur to me to submit it to HN.)

Every so often, I toy around with the idea of making it into a proper local/native application -- maybe someday. In the meantime, my obsession with regular expressions lives on in my current application (see bio) where I parse and rewrite the user's entered regex syntax (ICU) into whatever regex syntax the backend requires. I don't know of any other application that does this, but I predict that in 15 years it'll be commonplace (and I'll still be poor)!

Post reply on HN