[racket-dev] Missing pregexp syntax in Racket

From: David T. Pierson (dtp at mindstory.com)
Date: Tue Nov 29 07:16:39 EST 2011

On Mon, Nov 28, 2011 at 12:02:46AM -0800, Pauan wrote:
> Yes that is exactly it. The rationale is as ozzloy said: right now you
> needto use something like #px"\\\\\\d" to match the string "\\5".
> That's a lot ofbackslashes!
> In other languages that support regexps, there's usually a way of
> specifyingthem so it requires less backslashes. For instance, in
> JavaScript you can saythis: /\\\d/  But before we can even consider
> such a syntax, we first need to add in theabove mentioned regexp
> syntaxes. Because otherwise #px/\n/ would compile into(pregexp "\\n")
> which would then throw an error, as you noted. So this is thefirst
> step in enabling such a syntax.

OK, I think I understand your rationale.  And I think that #px/\d/ could
be useful.  But my first impression is that such a new #px reader syntax
should translate into the existing pregexp syntax, not extend it.  It
seems odd to me that #px/\n/ would mean #px"\\n" and that that would be
equivalent to #px"\n".

I'm curious what others think so I'll try to find the irc conversation.

David


Posted on the dev mailing list.