From: Junio C Hamano <gitster@pobox.com>
To: Kevin Ushey <kevinushey@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git grep -E doesn't accept \b word boundaries?
Date: Wed, 03 May 2023 12:35:55 -0700 [thread overview]
Message-ID: <xmqq1qjxqkbo.fsf@gitster.g> (raw)
In-Reply-To: <CAJXgQP1j6JYbtikMuWGFn44+FVb3PfmuwiFrxDGLQAYgr92Wfw@mail.gmail.com> (Kevin Ushey's message of "Wed, 3 May 2023 12:04:47 -0700")
Kevin Ushey <kevinushey@gmail.com> writes:
> I'm seeing the following, which I believe is unexpected. I have a file
> with contents:
>
> $ cat hello.txt
> WholeWord
> Whole Word
> Whole
>
> I can use `git grep` to search with word boundaries; e.g.
>
> $ git grep --untracked '\bWhole\b'
> hello.txt:Whole Word
> hello.txt:Whole
>
> However, if I add `-E` to use extended regular expressions, the same
> invocation finds no search results.
>
> $ git grep --untracked -E '\bWhole\b'
Does not seem to reproduce for me. In a randomly picked repository
(the source to git itself), I did
$ cat >hello.txt
WholeWord
Whole Word
Whole
^D
and "git grep --untracked -E '\bWhole\b' hello.txt" with or without
the "-E" option shows the same two lines as hits.
Without the pathspec hello.txt, the output includes one line from
unpack-trees.c as well, but the hits from the untracked hello.txt
are the same.
The tip of 'master', v2.40.0, v2.38.4, v2.37.4, v2.35.4 (they are by
no means significant milestones---just some random versions I picked
to test) all behave the same way.
next prev parent reply other threads:[~2023-05-03 19:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 19:04 git grep -E doesn't accept \b word boundaries? Kevin Ushey
2023-05-03 19:35 ` Junio C Hamano [this message]
2023-05-03 20:32 ` Kevin Ushey
2023-05-03 20:45 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1qjxqkbo.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=kevinushey@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.