help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Use Vertico + consult to do the search for an exact word.


From: Hongyi Zhao
Subject: Re: Use Vertico + consult to do the search for an exact word.
Date: Thu, 1 Jun 2023 17:59:15 +0800

On Thu, Jun 1, 2023 at 5:52 PM Tassilo Horn <tsdh@gnu.org> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> >> I don't use consult myself but I guess the search string is a regular
> >> expression.  So when you want to search for an exact word, use \bid\b
> >> to find all occurrences of the word id.
> >
> > I've tried this trick, but it cannot match the results like `$id$', as
> > shown in the attached screenshot, from where you can see that the
> > entry indexed by the circle numbered 1 doesn't appear in the
> > minibuffer's matching list.
>
> That's because $ is a word-character in the syntax-table of the mode you
> are using in that buffer.  You can try
> \([^a-zA-Z]\|\b\)id\([^a-zA-Z]\|\b\) which should also find $id$ and
> 1id02.

Yes. This works, as shown in the attached screenshot. But the input is
rather cumbersome. Are there more efficient/concise regexp patterns
for this goal?

> Bye,
> Tassilo

Regards,
Zhao

Attachment: image.png
Description: PNG image


reply via email to

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