[racket] Some design "whys" of regexps in Racket

From: Rodolfo Carvalho (rhcarvalho at gmail.com)
Date: Fri Jun 3 22:58:29 EDT 2011

Thank you very much!!

On Fri, Jun 3, 2011 at 23:47, Carl Eastlund <cce at ccs.neu.edu> wrote:
> >> I'm curious about 2 design decisions made:
> >> 1) Why do I have to escape things like "\d{2}" -> "\\d{2}"?
> [...]
> To clarify this, Racket reuses the syntax of strings for regexps.  A
> regexp is first read as a string, then parsed into a regular
> expression.  So if "\d" is the same as "d" as a string, the regexp
> parser never sees the backslash.  We do not currently have a reader
> for regexps that skips this intermediate step.

So I assume it's more of a matter of convenience and consistency, right?
It could well be done like "perl", as long as we create an specific reader.

On Fri, Jun 3, 2011 at 23:49, Carl Eastlund <cce at ccs.neu.edu> wrote:
> [..]
> The origin of #px is "Perl-compatible regular expression", while #rx
> are compatible with command-line tools such as egrep.

It seems that it's not yet documented. Good to know, now I can choose
between Perl and power :D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110603/ecdf9f73/attachment.html>

Posted on the users mailing list.