[erlang-questions] builtin regexp functions in Erlang/OTP R12B-3
Richard A. O'Keefe
ok@REDACTED
Tue Jun 17 03:26:45 CEST 2008
On 17 Jun 2008, at 3:08 am, Mats Cronqvist wrote:
> "This strategy is no longer practical: users have come to rely on
> backreferences for at least occasional use, and backreferences are
> part
> of the POSIX standard for regular expressions
> <http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html
> >."
That is perhaps misleading. POSIX has several stands for regular
expressions. The two principal ones are "Basic Regular Expressions",
which DO have backreferences, and "Extended Regular Expressions",
which DON'T. If you read the Single Unix Specification version 3,
Base Definitions, chapter 9 "Regular Expressions", and you will
learn (as I did) that if you want to use +, ?, or | in a regex,
Extended Regular Expressions are the only game in town, and you
DON'T get back references as well.
As far as I am aware there is no POSIX specification for any kind of
regular expression that includes _both_ alternatives and back-
references.
> i think not allowing backreferences is the correct choice for erlang.
> after all, erlang is about reliability. and it seems not being
> POSIX-compliant has worked for 20 years.
The only problem with full compliance with POSIX Extended Regular
Expressions is that public interfaces to locale data do not provide
enough information to support the [=x=] and [.x.] features.
More information about the erlang-questions
mailing list