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?
Regexper – Regular expressions visualizer
31–40 of 108 posts
Re: Regexper – Regular expressions visualizer
#32Re: Regexper – Regular expressions visualizer
#33No... 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
#34Re: Regexper – Regular expressions visualizer
#35Earlier 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.
Re: Regexper – Regular expressions visualizer
#36Re: Regexper – Regular expressions visualizer
#37Whenever 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
#38Re: Regexper – Regular expressions visualizer
#39After 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…
Re: Regexper – Regular expressions visualizer
#40My 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)!