[erlang-questions] builtin regexp functions in Erlang/OTP R12B-3

Tony Finch dot@REDACTED
Mon Jun 16 19:09:54 CEST 2008


On Mon, 16 Jun 2008, Robert Virding wrote:

> One quick comment is that I wonder if not part of the problem with PCRE and
> Perl regular expressions is that in one respect they are integrated into
> Perl and contain features to interact with the rest of Perl. If I remember
> correctly, for example, you can set Perl variables directly from the RE. Is
> this what became the named subexprs in PCRE?

Named subpatterns came to PCRE from Python. There isn't a syntax for
setting arbitrary Perl variables from a subpattern (nor is there in
Python). In perl-5.10, which is the first version that supports named
subexpressions, the named captures become values in a hash table. In
Python the MatchObject result has a group() method for accessing captures
by number or name.

Tony.
-- 
f.anthony.n.finch  <dot@REDACTED>  http://dotat.at/
HUMBER THAMES: VARIABLE 3 OR 4 BECOMING SOUTHWEST 4 OR 5, OCCASIONALLY 6
LATER. SLIGHT OR MODERATE. SHOWERS. GOOD.



More information about the erlang-questions mailing list