Arithmetic with Regexps
-
Brain Dump[^]:
There's a secret for Perl being so good at code golf, and this secret is clever use of regexp. The regexps from Posix are just finite automata, but the Perl engine is much more powerful than that. Naturally, I became tempted to check what are the computational limits of Perl's regexp. For example, can we do arithmetic with regexps? After thinking I while, I concluded that yes, we can do arithmetic with regexps!
When a problem arises, some think "I know, I'll use regex." Now you have a quadratic equation.
-
Brain Dump[^]:
There's a secret for Perl being so good at code golf, and this secret is clever use of regexp. The regexps from Posix are just finite automata, but the Perl engine is much more powerful than that. Naturally, I became tempted to check what are the computational limits of Perl's regexp. For example, can we do arithmetic with regexps? After thinking I while, I concluded that yes, we can do arithmetic with regexps!
When a problem arises, some think "I know, I'll use regex." Now you have a quadratic equation.
Terrence Dorsey wrote:
When a problem arises, some think "I know, I'll use regex."
Now you have 2 problems the one you started with and regex.
"The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)
-
Terrence Dorsey wrote:
When a problem arises, some think "I know, I'll use regex."
Now you have 2 problems the one you started with and regex.
"The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)