Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Ilkka Virta Newsgroups: gnu.bash.bug Subject: Re: Incorrect example for `[[` command. Date: Sat, 21 Sep 2019 01:53:37 +0300 Lines: 23 Approved: bug-bash@gnu.org Message-ID: References: <20190920124827.GP28751@eeg.ccf.org> <70f5667e-d91e-a4cf-fef0-b72c7d61a29a@iki.fi> <322f128f-0f7d-064c-2e47-baed38cb7493@case.edu> <965d0fd5-c448-6724-a48d-dac6fda9ced0@iki.fi> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1569020030 12525 209.51.188.17 (20 Sep 2019 22:53:50 GMT) X-Complaints-To: action@cs.stanford.edu To: chet.ramey@case.edu, bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 In-Reply-To: <322f128f-0f7d-064c-2e47-baed38cb7493@case.edu> Content-Language: en-US X-SASI-RCODE: 200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=subject:to:references:from:message-id:date:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtp; bh=YASz993I4G4yzBO93oB4cYFwKirzLVifp3CzkHtHiCw=; b=q2S7fghoPG8p7QeWutL+Wisdt2oJCvVRjjUM1A2cLIn3EL8XxBbxGLtBo5tjyBlCQ2gklZnMN5EZZeasu6ZU4gsivcjEbS5z8DX+A3/Lcp2vBsaQt4ZDYYjj7YelfRCgl107TrsQbng8TrdgHpdp3asxU6mZJapNWysOSAGVw17aqpuHcRpPYV3ssNFEUApgo3SBAPuY99DbV5mzCSk7xeBPY69mEW9ua3okMWid8H0HZtjmljlDLvGk4Ib29QQinnDQGNt556drpxxGHDdPaF2liR1hTmwAU/mubAEQ7D5tnDuegv6+5Nx07e1sPUI4IjRhrH/TjVgOeQTWinurrg== X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 157.24.2.213 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <965d0fd5-c448-6724-a48d-dac6fda9ced0@iki.fi> X-Mailman-Original-References: <20190920124827.GP28751@eeg.ccf.org> <70f5667e-d91e-a4cf-fef0-b72c7d61a29a@iki.fi> <322f128f-0f7d-064c-2e47-baed38cb7493@case.edu> Xref: csiph.com gnu.bash.bug:15385 On 20.9. 21:39, Chet Ramey wrote: > The portion of the manual before the example explains BASH_REMATCH and > BASH_REMATCH[0]. It also says "a sequence of characters in the value..." > when describing the pattern. Yeah, though the preceding paragraph contains both the general description of the regex match, and the mention of BASH_REMATCH, so the BASH_REMATCH angle could be a bit more explicit. So I'd probably say that the pattern would match e.g. 'xxx aabyyy', or 'xxxbyyy' and set $BASH_REMATCH to ' aab', or 'b', respectively. And then mention that the ^ and $ anchors could be used. I know the usual regex behavior is to find a match anywhere within the value, but since it's exactly the opposite of how regular pattern matches work, it's probably worth mentioning in some way. (Though I do think it's better to document things rather explicitly in general.) -- Ilkka Virta / itvirta@iki.fi