bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-match: \` and \= do not match when START is non-zero


From: Kevin Rodgers
Subject: Re: string-match: \` and \= do not match when START is non-zero
Date: Tue, 29 Apr 2003 17:54:51 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

I wrote:

\` or \= should match the empty string at index START in STRING.

(string-match "\\`bar\\'" "foobar" 3) and (string-match "\\=bar\\'" "foobar" 3) return nil. I think at least one of them should succeed and return 3, just like
(string-match "bar\\'" "foobar" 3) does.  Otherwise, how can you anchor the
REGEXP at index START in STRING?

[time passes]

(equal (string-match REGEXP STRING START) START)

[never mind]

Since START can be negative, that should be:

(equal (string-match REGEXP STRING START)
       (if (minusp START)
           (+ (length STRING) START)
         START))

I'm studying regex.c to see if I can implement \= matching in strings...

--
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;";>Kevin Rodgers</a>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]