Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15385 > unrolled thread

Re: Incorrect example for `[[` command.

Started byIlkka Virta <itvirta@iki.fi>
First post2019-09-21 01:53 +0300
Last post2019-09-21 01:53 +0300
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Incorrect example for `[[` command. Ilkka Virta <itvirta@iki.fi> - 2019-09-21 01:53 +0300

#15385 — Re: Incorrect example for `[[` command.

FromIlkka Virta <itvirta@iki.fi>
Date2019-09-21 01:53 +0300
SubjectRe: Incorrect example for `[[` command.
Message-ID<mailman.661.1569020030.2190.bug-bash@gnu.org>
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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web