Eli says that

(BTW, Racket's solution is something that is done in many other
> languages too.)



I come from Python where I can write

>>> re.findall("\d{2}", "06/03/2011")
['06', '03', '20', '11']

And printing the string that I used for my regexp gives:

>>> print "\d{2}"
\d{2}



That is writing strings is not exactly the same as writing "strings for a
regexp".


And then below Neil gives a plausible reason to want the syntax to be the
same.

If we are to exploit this consistency, then I see changing my head into
typing double backslashes for special regexps constructs a "price worth
paying" (given a previous background). For fresh minds, this sounds like a
very good idea.


On Fri, Jun 3, 2011 at 23:58, Neil Van Dyke <n...@neilvandyke.org> wrote:

> [...]
>
>
> Also, regexps used to be specified using strings in Racket, and still can
> be, for good reason:
>
>   (regexp (string-append "^\\d+ " (regexp-quote some-var) "$"))
>
>   #rx"^\\d+"
>
> As a programmer, getting escaping right is hard enough as it is.  You
> wouldn't want to do escaping one way for string literals and a different way
> for #rx -- that would be begging for hard-to-find bugs.



[]'s

Rodolfo Carvalho
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to