On 07/25/2011 12:30 AM, Bruno Haible wrote:
Hi,

GNU grep (I tested versions 2.5, 2.7, 2.9) appears to assign a meaning to
the backslash single-quote character sequence in the argument that ought to
be a Basic Regular Expression.

$ grep --version
grep (GNU grep) 2.9
...
$ echo ' abc" ' | grep "\"\\'"
$ echo ' abc"' | grep "\"\\'"
  abc"

It's end-of-buffer, together with \` for beginning of buffer. It makes a difference from ^ and $ when using -z, IIRC.

As a quality of implementation issue, I would prefer to get an error message
for such an undefined BRE.

I don't think this is a good idea. There are certainly a lot of scripts in the wild using \" (due to confusion about quoting) or \- (due to lack of knowledge of "--" command-line behavior).

Paolo

Reply via email to