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

Robert Virding rvirding@REDACTED
Mon Jun 16 21:31:39 CEST 2008


2008/6/16 Tony Finch <dot@REDACTED>:

> 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.


Then I am at least partially right, not variables but keys in table. Still
you can access them by name anyway which means that the name exporting from
the regexp into the surrounding programs works.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080616/ec10eaea/attachment.htm>


More information about the erlang-questions mailing list