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

From: "Bob Vincent Il (US)" <[email-masked]>
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)<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.

________________________________