Subject: Re: bug#14013: 24.3.50; dired-isearch-filenames-regexp is matching text outside filenames

From: Stefan Monnier <[email-masked]>
Date: Tue, 15 Feb 2022 22:57:57 -0500

>> I don't know if we want to handle ^ specially, but if we do we can use
>> something like:
>>
>>     (while (string-match "\\^" RE i)
>>       (setq i (match-end 0))
>>       (if (not (subregexp-context-p RE (match-beginning 0)))
>>           ;; The ^ is inside a char-range or escaped or something.
>>           nil
>>         (setq RE (replace-match (concat "\\(?:"
>>                                         directory-listing-before-filename-regexp
>>                                         "\\)")
>>                                 t t RE))))
>
> Will matches then not be discarded by `dired-isearch-filenames-mode'
> because they start before the file name?

It all depends on the replacement regexp the code uses.  I only used
`directory-listing-before-filename-regexp` as an example.

        Stefan