emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#20443: closed (grep pattern is forward slash + sta


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20443: closed (grep pattern is forward slash + star)
Date: Mon, 27 Apr 2015 20:54:02 +0000

Your message dated Mon, 27 Apr 2015 14:53:02 -0600
with message-id <address@hidden>
and subject line Re: bug#20443: grep pattern is forward slash + star
has caused the debbugs.gnu.org bug report #20443,
regarding grep pattern is forward slash + star
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20443: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20443
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: grep pattern is forward slash + star Date: Mon, 27 Apr 2015 13:05:11 -0600 User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
Dear Coders,

if I echo 'a  *  z' | grep '/*' it succeeds and prints 'a  *  z'.
Can this be right?

echo 'a  *  z' | grep -F '/*' fails as expected.

Tested in Salix on grep-2.14 and freshly compiled grep-2.21.

Thanks,




--- End Message ---
--- Begin Message --- Subject: Re: bug#20443: grep pattern is forward slash + star Date: Mon, 27 Apr 2015 14:53:02 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
tag 20443 notabug
thanks

On 04/27/2015 01:05 PM, Clay Hansen wrote:
> Dear Coders,
> 
> if I echo 'a  *  z' | grep '/*' it succeeds and prints 'a  *  z'.
> Can this be right?

Yes.  The regular expression '/*' says to match 0-or-more instances of
'/'. 'a  *  z' has zero instances of '/', so it matches and gets printed.

> 
> echo 'a  *  z' | grep -F '/*' fails as expected.

That's the literal pattern '/*', which does not appear in your input.

Remember, to convert the literal pattern of '/*' under -F to a regular
expression when not using -F, you must escape any characters that are
otherwise special to regular expressions.  Your second command would be
equivalent to:

echo 'a  *  z' | grep '/\*'

where the '*' now matches a literal star rather than being the
0-or-more-operator.

As such, this is not a bug, so I'm closing the report.  However, feel
free to ask further questions on the topic.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

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