[erlang-questions] regular expressions (again :)
Richard A. O'Keefe
Thu Dec 14 02:13:58 CET 2006
Gaspar Chilingarov <nm@REDACTED> wrote:
In most text-processing tasks you do not need exactly same
regexp second time.
Whaaaat? When I use AWK, my regular expressions may get applied
MILLIONS of times! I want them compiled just once, thank you very much!
More generally, people who have been brainwashed by AWK and Perl think
of a regular expression as a kind of TOKEN instead of as a kind of
EXPRESSION. If you have a language (like SNOBOL) in which concatenation
and alternation and so on a genuine operators that can be applied to
computed values, then you very often find that one pattern can be used
*as a building block* in making many other patterns.
I note that having a regular expression compiler that returns a function
is a popular approach in Scheme.
More information about the erlang-questions