[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp character classes not supported?
From: |
Mark H Weaver |
Subject: |
Re: regexp character classes not supported? |
Date: |
Fri, 28 Dec 2012 14:15:27 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Limbo Peng <address@hidden> writes:
> On Sat, Dec 29, 2012 at 1:22 AM, Mark H Weaver <address@hidden> wrote:
>
> Regular expression syntax is not standardized, and there are
> several
> different variants. The "\d" syntax for character classes is a
> non-standard perl extension, and is not supported by Guile.
>
>
> Thx...seems that I've been taking such syntax for granted for a long
> time :(
>
> BTW: I've found a module called pregexp which looks more powerful -
> does it work well in Guile?
First, I should note that any regexp matcher written in Scheme will be
much slower than the one built-in to Guile (which is written in C).
There are some additional problems with pregexp. It does not appear to
be written with Unicode in mind, and is also written in such a way that
it will probably perform quite poorly on future versions of Guile.
If you'd like a more advanced regexp library, and don't mind the fact
that it will be much slower than Guile's built-in regexps, I recommend
that you look at Alex Shinn's irregex package:
http://synthcode.com/scheme/irregex/
Irregex is written with Unicode in mind, and supports not only
perl-style regexps, but also Olin Shivers' SRE (Scheme Regular
Expression) syntax, which is a far superior notation for complex
or dynamically-constructed regexps.
http://www.ccs.neu.edu/home/shivers/papers/sre.txt
Regards,
Mark