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

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 01 Jun 2023 03:16:02 +0000

Your bug report

#63819: Gnu `grep '.*'` does not match an empty string.

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
63819: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63819
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#63819: Gnu `grep '.*'` does not match an empty string.
From: Paul Eggert <[email-masked]>
To: "Bob Vincent Il (US)" <[email-masked]>
Cc: [email-masked]
Date: Wed, 31 May 2023 20:15:30 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

Subject: Gnu `grep '.*'` does not match an empty string.
From: "Bob Vincent Il (US)" <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Wed, 31 May 2023 17:18:30 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

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)<mailto:[email-masked]>

PwC IT - NGC - PUPPET DEV OPS<https://wwwpwcnetwork.pwc.myshn.net/nav_to.do?uri=sys_user_group.do?sys_id=16aec8f0db7e145cd9703423f39619de> | Senior Manager

Work: 906-984-3549<tel:+1.906.984.3549>
Mobile: 770-744-1792<tel:+1.770.744.1792>
PricewaterhouseCoopers LLP
@workday<https://wd3.myworkday.com/pwc/d/inst/1$37/247$701091.htmld> @github<https://github.pwc.com/robert-a-vincent-ii> @ServiceNow<https://wwwpwcnetwork.pwc.myshn.net/nav_to.do?uri=sys_user.do?sys_id=2421e2591b2e081483c254207e4bcb7b%26sysparm_view=ess>

________________________________

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.

________________________________