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

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

bug#63819: closed (Gnu `grep '.*'` does not match an empty string.)


From: GNU bug Tracking System
Subject: bug#63819: closed (Gnu `grep '.*'` does not match an empty string.)
Date: Thu, 01 Jun 2023 03:16:01 +0000

Your message dated Wed, 31 May 2023 20:15:30 -0700
with message-id <9f737863-fbad-b673-930d-e5ccca682266@cs.ucla.edu>
and subject line Re: bug#63819: Gnu `grep '.*'` does not match an empty string.
has caused the debbugs.gnu.org bug report #63819,
regarding Gnu `grep '.*'` does not match an empty string.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
63819: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63819
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Gnu `grep '.*'` does not match an empty string. Date: Wed, 31 May 2023 17:18:30 +0000
I discovered only today that the following commands all behave identically:
  • grep -q '.*'
  • grep -q '.\+'
  • grep -q .
  • grep -qE '.*'
  • grep -qE '.+'
  • grep -qE .
Gnu grep documentation says:

The period ‘.’ matches any single character. It is unspecified whether ‘.’ matches an encoding error.
and
*

The preceding item is matched zero or more times.


I would think that an empty string matches "zero or more of any single character".

Can anyone point out where the documentation says otherwise?


Bob Vincent (US) 

PwC IT - NGC - PUPPET DEV OPS | Senior Manager

Work: 906-984-3549
Mobile: 770-744-1792
PricewaterhouseCoopers LLP
@workday @github @ServiceNow




The information transmitted, including any attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited, and all liability arising therefrom is disclaimed. If you received this in error, please contact the sender and delete the material from any computer.


In the event the content of this email includes Tax advice, the content of this email is limited to the matters specifically addressed herein and is not intended to address other potential tax consequences or the potential application of tax penalties to this or any other matter.


PricewaterhouseCoopers LLP is a Delaware limited liability partnership. This communication may come from PricewaterhouseCoopers LLP or one of its subsidiaries.




--- End Message ---
--- Begin Message --- Subject: Re: bug#63819: Gnu `grep '.*'` does not match an empty string. Date: Wed, 31 May 2023 20:15:30 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 2023-05-31 19:17, Bob Vincent Il (US) wrote:
Okay, but `echo ''` does not output an empty string. It outputs a line feed 
character.

The line feed is not considered. Grep looks only for matches of "any part of the line excluding the terminating <newline>" <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html>.

Closing the bug report as it appears to be due to a misunderstanding of how 'grep' works.


--- End Message ---

reply via email to

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