* string-match: \` and \= do not match when START is non-zero
@ 2003-04-24 17:37 Kevin Rodgers
2003-04-26 2:31 ` Richard Stallman
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2003-04-24 17:37 UTC (permalink / raw)
\` 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]
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.5160.1051205842.21513.bug-gnu-emacs@gnu.org>]
* Re: string-match: \` and \= do not match when START is non-zero
[not found] <mailman.5160.1051205842.21513.bug-gnu-emacs@gnu.org>
@ 2003-04-29 23:54 ` Kevin Rodgers
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2003-04-29 23:54 UTC (permalink / raw)
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:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-29 23:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-24 17:37 string-match: \` and \= do not match when START is non-zero Kevin Rodgers
2003-04-26 2:31 ` Richard Stallman
[not found] <mailman.5160.1051205842.21513.bug-gnu-emacs@gnu.org>
2003-04-29 23:54 ` Kevin Rodgers
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.