[racket] Bug matching shortest possible matches in regexp-replace*

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jan 13 13:06:16 EST 2011

Fixed - thanks for the report!

At Wed, 12 Jan 2011 17:15:47 +0000, Noel Welsh wrote:
> A pattern like (.)? causes the following error:
> 
> racket@> (regexp-replace* #px"(.)?" "a" (lambda args "foo"))
> car: expects argument of type <pair>; given #f
> 
>  === context ===
> /usr/local/plt-head/collects/racket/private/string.rkt:174:7: loop
> /usr/local/plt-head/collects/racket/private/string.rkt:314:11: core
> /usr/local/plt-head/collects/racket/private/misc.rkt:78:7
> 
> 
> Replace the insert function with a string and it works:
> 
> racket@> (regexp-replace* #px"(.)?" "a" "foo")
> "foofoo"
> 
> 
> Get rid of the ? and it works:
> 
> racket@> (regexp-replace* #px"(.)" "a" (lambda args "foo"))
> "foo"
> 
> 
> I guess this has to do with constructing the args list to apply to the
> insert function.
> 
> N.



Posted on the users mailing list.