bin/166842: bsdgrep(1) inconsistently handles ^ in non-anchoring positions

Jim Pryor dubiousjim at gmail.com
Thu Apr 12 04:10:13 UTC 2012


The following reply was made to PR bin/166842; it has been noted by GNATS.

From: Jim Pryor <dubiousjim at gmail.com>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: bin/166842: bsdgrep(1) inconsistently handles ^ in non-anchoring
 positions
Date: Thu, 12 Apr 2012 00:00:46 -0400

 On Wed, Apr 11, 2012, at 03:21 PM, Jim Pryor wrote:
 > I've noticed some more issues with the same version of grep. I don't
 > know whether they're related, but I'll append them here for now.
 > 
 > $ printf abc | grep -o '^[a-c]'
 
 Some more observations that seem related:
 
 $ printf 'abc def' | grep -o '^[a-z]'
 
 will match against each of the letters in 'abc', but not against any of
 the letters in 'def'.
 
 On the other hand:
 
 $ printf 'abc def' | grep -o '\b[a-z]'
 $ printf 'abc def' | grep -o '\<[a-z]'
 
 will each match against all six of the letters.
 
 Matching against the patterns:
   '[a-z]\b'
   '[a-z]\>'
   '[a-z]$'
 gives correct results.
 -- 
 dubiousjim at gmail.com
 


More information about the freebsd-bugs mailing list