[plt-scheme] Possible bug in regexp?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Apr 27 09:07:29 EDT 2010

At Tue, 27 Apr 2010 08:52:53 -0400, "Todd O'Bryan" wrote:
> 
> (regexp-match?
>        #rx"^\"([^\"#\u0000]| |#\return#\newline|#\tab|\\\\\")*\"$"
>        "\")!\"")
> 
> succeeds, but

I think that was meant to be

 (regexp-match?
        #rx"^\"([^\"\u0000]| |\r\n|\t|\\\\\")*\"$"
        "\")!\"")

That is, the syntax for character escapes in a string is different from
the syntax of character literals.

> (regexp-match?
>        #rx"^\"([^\"#\u0000-#\u0000]| |#\return#\newline|#\tab|\\\\\")*\"$"
>        "\")!\"")

The expression

 (regexp-match?
        #rx"^\"([^\"\u0000-\u0000]| |\r\n|\t|\\\\\")*\"$"
        "\")!\"")

produces #t.

> (regexp-match?
>        #rx"^\"([^\"#\u0000-#\u0001]| |#\return#\newline|#\tab|\\\\\")*\"$"
>        "\")!\"")

The expression

 (regexp-match?
        #rx"^\"([^\"\u0000-\u0001]| |\r\n|\t|\\\\\")*\"$"
        "\")!\"")

also produces #t.



Posted on the users mailing list.