[EMAIL PROTECTED] (Kim F. Storm) writes:

> David Kastrup <[EMAIL PROTECTED]> writes:
>
>>> Actually the only cases I can vaguely remember using the
>>> (/ (length (match-data)) 2) idiom didn't use the whole (match-data).
>>> They typically used the idiom in order to know *which* subgroup matched (of
>>> course it only works if you craft your regexp carefully).
>>
>> That would not work.  (length (match-data)) is a property of the
>> regexp, not the match.
>
> According to the code, it does work.
>
> Match data only contains markers until the last successful match.

(progn (string-match "\\(x\\)\\|\\(y\\)" "x") (match-data)) => (0 1 0 1)

I stand corrected.

Hey, can I rely on that?  It would probably speed up some code of mine
where I have to scan for the only non-nil match-beginning.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to