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

Hynek Vychodil vychodil.hynek@REDACTED
Wed Jun 18 14:10:25 CEST 2008


If you look in perldoc perlre, there is many more strange features in perl
"regular" expressions. For example:
"branch reset" (?|pattern) - fix backrefs numbers after this group
"call to perl code" (?{ code }) - very good joke :-)
"code generated pattern" (??{ code }) - dtto
"parentheses back referencing" (?PARNO) - as previous, very good for making
recursive patterns
conditional patterns and more and more. I like it, but I argue don't
implement it any more outside perl world :-)

In result, perl regular expressions are very irregular.

2008/6/16 Robert Virding <rvirding@REDACTED>:

> 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
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080618/5bd0d8ef/attachment.htm>


More information about the erlang-questions mailing list