From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 12 04:10:13 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F39ED106566B for ; Thu, 12 Apr 2012 04:10:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D8CA88FC14 for ; Thu, 12 Apr 2012 04:10:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3C4ACdT071291 for ; Thu, 12 Apr 2012 04:10:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3C4ACqg071289; Thu, 12 Apr 2012 04:10:12 GMT (envelope-from gnats) Date: Thu, 12 Apr 2012 04:10:12 GMT Message-Id: <201204120410.q3C4ACqg071289@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jim Pryor Cc: Subject: Re: bin/166842: bsdgrep(1) inconsistently handles ^ in non-anchoring positions X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jim Pryor List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2012 04:10:13 -0000 The following reply was made to PR bin/166842; it has been noted by GNATS. From: Jim Pryor To: bug-followup@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@gmail.com