Closed milkypostman closed 2 years ago
This is because a failed `string-match' does not unset the match data, instead it merely forgoes overriding the existing match data:
(progn
(string-match "1" "1")
(string-match "1" "2")
(match-string 0 "3"))
=> "3"
I've also added a bit of cleanup.
Looks good to me. Feel free to merge whenever. Thanks!
Done :grinning:
Before this change, for some reason unknown to me, if the
string-match
failed, the call tomatch-string
would still return a result. A tag0.16.0
with a regexp offoo/v\\(.*\\)
was failing to match but was still return0.16.
as a result for the call tomatch-string
.With this change,
match-string
isn't even called if there is no string match.This is related to melpa/melpa#7821