bug-grep
[Top][All Lists]
Advanced

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

Re: meaning of backslash single-quote?


From: Paolo Bonzini
Subject: Re: meaning of backslash single-quote?
Date: Wed, 27 Jul 2011 11:31:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

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

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