[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature/native-comp f055f52 1/2: * Fix two find function functions f
From: |
martin rudalics |
Subject: |
Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation |
Date: |
Mon, 9 Mar 2020 18:11:27 +0100 |
>> >> + ((string-match "\\.eln$" library)
>> > ^
>> > \\'
>>
>> Why?
>
> "\\.eln$" matches lines ending in ".eln", "\\.eln\\'" matches only if
> the string ends in ".eln", which is presumably the intention.
I didn't read the source but a name like "library" suggests that the
string to match against may contain more than one match. In either
case, using "\\'" means that that string must be constructed carefully
to eliminate a trailing newline.
But wrt my question I was just curious whether the regexp engine
contains an optimization that makes "\\'" match faster than "$".
> Using
> string-suffix-p could be even clearer.
Indeed.
martin