Subject: bug#32328: match-beginning: return nil if search failed

From: "Basil L. Contovounesios" <[email-masked]>
Date: Wed, 01 Aug 2018 17:39:46 +0300

Andreas Röhler <[email-masked]> writes:

> match-beginning tells: Return value is undefined if the last search failed.
>
> Consider it a gain if it returns nil when failing.

I think match-string already implicitly relies on the suggested
behaviour; compare its docstring:

  Value is nil if NUMth pair didn't match, or there were less than NUM pairs.

with its implementation:

  (if (match-beginning num)
      (if string
          (substring string (match-beginning num) (match-end num))
        (buffer-substring (match-beginning num) (match-end num))))

-- 
Basil