Ah thanks James, I missed the pending nil. The actual value is still nil
indeed:

user=> (def m (re-matches #".*(foo\.gif).*" "foo.gif\n"))
"foo.gif\n"#'user/m
user=> m
nil

Not sure what would be the cause here then, but the random printing of the
second argument of re-matches also happens when I evaluate an arbitrary
function after the exception

PatternSyntaxException Unmatched closing ')' near index 13
.*(foo\.gif).*)
             ^  java.util.regex.Pattern.error (Pattern.java:1924)
RuntimeException Unmatched delimiter: )  clojure.lang.Util.runtimeException
(Util.java:221)
user=> (list 1 2)
"foo.gif\n"(1 2)

cider doesn't have this problem either it seems



On Tue, Jun 16, 2015 at 12:56 PM, James Reeves <ja...@booleanknot.com>
wrote:

> On 16 June 2015 at 10:19, Jeroen van Dijk <jeroentjevand...@gmail.com>
> wrote:
>
>> I came accross this weird case below with re-matches (in clojure 1.6).
>> For some reason the pattern matches, once just once, only after a parse
>> exception. This pattern repeats with every follow up parse exception. Is
>> this a known bug? It seems to be related with the pending newline too.
>>
>> user=> (re-matches #".*(foo\.gif).*" "foo.gif\n")
>> nil
>> user=> (re-matches #".*(foo\.gif).*)" "foo.gif\n")
>>
>> PatternSyntaxException Unmatched closing ')' near index 13
>> .*(foo\.gif).*)
>>              ^  java.util.regex.Pattern.error (Pattern.java:1924)
>> RuntimeException Unmatched delimiter: )
>>  clojure.lang.Util.runtimeException (Util.java:221)
>> user=> (re-matches #".*(foo\.gif).*" "foo.gif\n")
>> "foo.gif\n"nil
>>
>
> This doesn't indicate a matching pattern. It still returns nil, but it
> also prints "foo.gif\n". If you hit return instead of running the same
> command again, you'll see the same text printed.
>
> My guess is that this is an nrepl issue, as this problem doesn't occur
> when running the Clojure REPL directly from the Clojure jar.
>
> - James
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to