scsh-hackers
[Top] [All Lists]

Re: Minor bug with match:substring

To: John Ribe <netscapemessenger@ribe.mailshell.com>
Subject: Re: Minor bug with match:substring
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Thu, 06 Apr 2006 10:57:40 +0200
Cc: scsh-hackers@scsh.net
List-id: Discussion among the implementors <scsh-hackers.list-id.scsh.net>
John Ribe <netscapemessenger@ribe.mailshell.com> writes:

> I think this is a bug in match:substring.  I revised my code to work
> around
> it, so this is just for your information, I am not looking for a fix.
>
> scsh manual says
>    match:substring returns the substring matched regexp's submatch. If
>    there was no match for the indexed submatch, it returns false.
>
> But this code
>    (match:substring
>      (string-match
>         (posix-string->regexp "Job <(.*)> is submitted")
>         ""
>          )
>      1)
>
> Returns this error
>    Error: exception
>           (record-ref #f 0)
>
But this has nothing to do with MATCH:SUBSTRING. Your call to
STRING-MATCH already returns false:

> (string-match
        (posix-string->regexp "Job <(.*)> is submitted")
        ""
         )
#f

So you must not apply MATCH:SUBSTRING to the result.

-- 
Martin

<Prev in Thread] Current Thread [Next in Thread>