Skip to contentSkip to conversation

git grep and word boundaries

DISCUSSION Thomas Volpini 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

it seems that git grep doesn't do word boundaries as described:

$ cat bar
foo bar baz
$ grep "\<bar\>" *
foo bar baz
$ git grep "\<bar\>" *
$ git grep -w "\<bar\>" *
$ git grep -w "bar" *
bar:foo bar baz
$ git grep -E "\<bar\>" *
$ git grep -E "\bbar\b" *
$

thanks,
Thomas

#1 lore raw
Quoted 4 lines · Thomas Volpini

Hello,

it seems that git grep doesn't do word boundaries as described:

Quoted 11 lines
 $ cat bar
 foo bar baz
 $ grep "\<bar\>" *
 foo bar baz
 $ git grep "\<bar\>" *
 $ git grep -w "\<bar\>" *
 $ git grep -w "bar" *
 bar:foo bar baz
 $ git grep -E "\<bar\>" *
 $ git grep -E "\bbar\b" *
 $

It works here. Did you add the file?

$ grep "\<bar\>" *
foo bar baz
$ git grep "\<bar\>"
bar:foo bar baz
$ git grep "\<bar\>" *
bar:foo bar baz
$ git grep \\bbar\\b
bar:foo bar baz
$ git grep \\bbar\\b *
bar:foo bar baz
Signature · 2 lines
Luciano Rocha <[email protected]>
Eurotux Informática, S.A. <http://www.eurotux.com/>