[racket] Locating substring with reserved characters

From: Jukka Tuominen (jukka.tuominen at finndesign.fi)
Date: Sat Sep 3 04:11:51 EDT 2011

That's it, thanks!

#lang racket

(regexp-match-positions* (regexp-quote "5 (+ 1 2 3)") "((named-lambda (plus
x y) (+ x y)) 5 (+ 1 2 3))")
;>> '((35 . 46))


br, jukka


> -----Original Message-----
> From: Neil Van Dyke [mailto:neil at neilvandyke.org]
> Sent: 03 September 2011 11:03
> To: Jukka Tuominen
> Cc: users at racket-lang.org
> Subject: Re: [racket] Locating substring with reserved characters
>
>
> Jukka Tuominen wrote at 09/03/2011 03:56 AM:
> > I'm trying to locate a substring that I want to be treated just
> as a string
> > rather than regexpr notation.
>
> I think you want "regexp-quote".
>
> (regexp (regexp-quote "5 (+ 1 2 3)"))
> ;;==> #rx"5 \\(\\+ 1 2 3\\)"
>
> --
> http://www.neilvandyke.org/



Posted on the users mailing list.