News for hackers. Stuff that matters.
Re:Regexper – Regular expressions visualizer by avar on Tuesday January 30, 2018 @11:23AM (#16266515)
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 eventually complete.
Re:Regexper – Regular expressions visualizer by shakna on Tuesday January 30, 2018 @11:54AM (#16266816)
Wow. Despite the utterly insane complexity of a regex of that size, it doesn't seem to do an insane amount of branching. Maximum depth of choices seems to be about 4, which is less than a lot of other regex examples I've seen here.

That being said... That regex is just noise. Nobody can tackle it all at once or by themselves, unless they specialise in just regex. It's 6599 characters, at least on my system. So at a wild stab, its the equivalent of 4,500 lines of obfuscated code.

You can't audit it, you just kinda have to trust it, and hope.

But with something like regexper, I can at least read it.

Re:Regexper – Regular expressions visualizer by singingfish on Tuesday January 30, 2018 @05:41PM (#16269774)
Here, have a 1800 line regex which parses perl: https://metacpan.org/source/DCONWAY/PPR-0.000003/lib/PPR.pm#...
Re:Regexper – Regular expressions visualizer by avar on Tuesday January 30, 2018 @04:05PM (#16269013)
I can't remember where, but there's some version of that regex somewhere that uses variables for interpolation in subsequent regexes.

Viewed like that it's really not that complex, most of it is repetition of previously used regex sequences, it's only when fully expanded that it becomes so humongous.

Re:Regexper – Regular expressions visualizer by shakna on Tuesday January 30, 2018 @06:26PM (#16270065)
The pattern is Jeffrey Friedl's, from his book Mastering Regular Expressions.

And as clear as the source could be made, I feel the fact that so many people have just copied and pasted it means that any understanding is lost, and they're just praying and hoping, because a regex of that size is actually difficult for them to comprehend.

Re:Regexper – Regular expressions visualizer by joosters on Tuesday January 30, 2018 @01:07PM (#16267415)
This short link seems to work:

http://1b.yt/exfqj

(regexper.com doesn't seem to cache results, so this is going to hit their site hard...)

[edit: oops, it's all client-side so no problem for the site]

Re:Regexper – Regular expressions visualizer by gruez on Tuesday January 30, 2018 @11:40AM (#16266688)
>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?

Re:Regexper – Regular expressions visualizer by shakna on Tuesday January 30, 2018 @11:57AM (#16266839)