3 ms·
If you know anything about regular expressions, perhaps considering yourself a fairly decent expert... you might even know how to write basic recursive regexes.
by developer2 10y ago
If you know anything about regular expressions, perhaps considering yourself a fairly decent expert... you might even know how to write basic recursive regexes. Then you are like me and think you know how to begin ripping apart any regex.
Then you see "<^<()(?R){2}>\z|\1\Q^<()(?R){2}>\z|\1\Q>", and you can't even begin to parse it. For one, I didn't know you could add a quantifier to a recursive pattern. Then there is a backreference to what appears to be an empty capture, which is part of an alternation for fuck's sake, which also happens to include the \Q notation.
I imagine I am in the top 20-30% of regular expression users. And I straight up do not understand a single aspect of how this expression manages to match anything, let alone its intended purpose.
It doesn't matter how this regex was found. Whether it was obtained through an entirely manual process or assisted by some kind of AI, it's beyond incredible. 99.9999xxx% of senior software developers who have been programming for 30+ years could not come up with this if they were given 10 years to try and discover it out without 3rd party assistance.
>> These are smart people of course, but it's easy to get overly impressed
How bloody arrogant, and frankly a bullshit statement from someone who has no idea what they are talking about. This is amazing. Someone would have to sit down with me for at least a week - probably 3+ months - to even begin to explain to me exactly how this works.
Why did I take this comment so personally? I don't know, it sounds like the parent has never even seen a regular expression, and yet is trying to promote their own sense of worth as if they're a genius when in fact they have an IQ of 40. That somehow the people who managed to figure this out are only lucky to have done so, rather than there being any significant time or skill involved. I bet you there are less than a thousand human beings on Earth who could have solved this. It's likely that the people who fucking designed and wrote PCRE could not have even solved this.
Basically, stfu. Why do you have to comment only to diminish someone else's success story? You couldn't have solved this, so don't even try to minimize the achievements of others.
- kevinwang 10y agoI didn't read that as trying to diminish the brilliance of the original accomplish, but just trying to frame it less as "magic" or "genius" that is incomprehensible and more as an impressive human feat by a human who had to do hard human work to get there. I believe the intent was to encourage us not to lessen the extent to which we believe that this is something that only a higher class of people can do. Ie: yes, we can't comprehend it on first glance, but they didn't come up with it instantly either. They spend time gradually working and modeling the problem in their head so that the end result is comprehensible to them.
- murbard2 10y agoThank you, that was indeed my intent here. I don't want to take away anything from the achievement, but you explained it better than I did.