While browsing I've bumped into a mindblowingly useful tool when it comes to regular expressions: Lookaround Zero-Length Assertions - https://www.regular-expressions.info/lookaround.html .
It's that thing, that set of characters, which makes your search capable of matching, for example, (beginning of a line)#
, but only, if the #
is preceded by |
and then NEWLINE
- like in orgmode spreadsheets the first of multiple formulas. So, the context behind or before is considered for matching without this context to be added into the result string as additional characters.
What made me understand this in the first place was this section:
Lookbehind has the same effect, but works backwards. It tells the regex engine to temporarily step backwards in the string, to check if the text inside the lookbehind can be matched there. (?<!a)b matches a “b” that is not preceded by an “a”,
Some research revealed that there seemed to be some effort going on to add this feature to emacs: https://emacs.stackexchange.com/a/32782
The question now is: 2023/2024 - can any of the emacs versions newer than 24.1 do it? Because this is really a great feature, irreplaceable valuable.
UPDATE <2023-12-26 Tue> - @comments:
@all: Thx 4 feedback.
@shynur: Well, that fits, you're welcome.
@phils: Ah, you mean a 2-step filtering: 1st/2 steps - main filtering, resulting in a mixed bag of results, both, results you want and results you don't want - and then 2nd/2 steps - supplementary filtering, sorting out the matches within the mixed bag of results, that you don't want to have. Haha, true. Well, but also: Indeed, excluding all, who haven't unlocked the necessary elisp programming skills necessary for that, yet - like me.
@db48x: Thx 4 clarification.