3 ms·
I agree with you to a certain extent, but I think it's also important to realize that, just as languages evolve and dialects diverge, technical jargon evolves a
by lmkg 16y ago
I agree with you to a certain extent, but I think it's also important to realize that, just as languages evolve and dialects diverge, technical jargon evolves and diverges into dialects as well. To a large class of programmers, the non-DFA perl-type regex is more common and more important than the formally defined regular expression. The overlap is inconvenient, for exactly the reasons you state, and I wish it didn't exist, but it's unrealistic to expect one camp or the other to abandon their ingrained term for a common concept.
For my part, I use "regular expression" for the DFA-expressible grammar and "regex(en)" for the string-processing facility. The most important thing is clarity, and as long as you're being clear about which type of regular expression you're talking about, the double-meaning may be twitch-inducing but it doesn't impede communication.
- eru 16y agoThat's a reasonable convention. (Another less reasonable one, is to use the term `Frankenxpression'.)
- lloeki 16y agoIndeed I do the same kind of distinction with the exact same naming convention. Now this does not detract to the fact that this regex is quite elegant in its simplicity and we often assume our hardware+software stack to be actual Turing machines. Call me paranoid but finding such a simple expression and seeing it validate a number being a prime in such record times should have raised some alarms. Indeed, removing the "optimization" makes computing times go through the roof.
- lukeschlather 16y agoI think you've completely missed the point of the exercise. This is not about optimization. It's about having a deep knowledge of how Perl-style regular expressions work.
- lloeki 16y agoSorry, this was not my intention to mean so: I used "optimization" for lack of finding the correct word regarding the role of the PCRE setting. My point was that the quickness of the initial results was fishy enough to doubt of the correctness of those results (and hence diving into regex engine probing), even before finding actual false positives.