[racket-dev] Missing pregexp syntax in Racket

From: Pauan (pcxunlimited at gmail.com)
Date: Mon Nov 28 03:02:46 EST 2011

Sorry for the confusion. Ideally most of the syntax described will
beavailable in both pregexp and regexp mode, but "\\X" and
"\\u{E0}"should probably be restricted to pregexp only.

> To add to my confusion, your original email mentioned #px"\\\\n", which> currently matches a backslash followed by an 'n'.
Yes, that was me overthinking things. The pattern I described is a
regexpused to match a regexp. In other words, I was saying that
#px"\\n" shouldmatch a newline.

> Perhaps you are suggesting that #px"\\n" should mean the same as> #px"\n" rather than being an error?  I don't see a need for this but> perhaps you have a rationale in mind?
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.
I am willing to write the code and unit tests for this.



Posted on the dev mailing list.