[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add some aliases for re-related functions

From: Stefan Monnier
Subject: Re: Add some aliases for re-related functions
Date: Sat, 02 May 2020 18:49:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> [ I'm trying to use "search" and "match" in the way it's used in
>>    traditional regexp libraries.  ]
> Guess I'm unfamiliar with said libraries. I'd suggest re-looking-at and
> re-looking-back (or whatever, like, don't create an alias for the last 
> one if we don't want to).

Most of the literature on regular expressions concentrates on the
problem of finding whether a given string matches a given regexp, where
"matching" here means that the regexp matches the whole string.

Think of it as the case where the regexp starts with \` and ends with \'

Then there's the relaxation of "finding the longest match" (what we
call `looking-at`) and then "finding the leftmost longest match" (what
we call `string-match`).

Those two have traditionally be named `re_match` and `re_search`
respectively in C libraries (as can be seen in `src/regexp-emacs.c`).


PS: BTW, `looking-back` doesn't do a "match" of the "longest match that
ends at point" but a "search" for the "rightmost longest match that ends
at point" since it uses `re-search-backward` internally.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]