Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15381 > unrolled thread
| Started by | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| First post | 2019-09-20 08:48 -0400 |
| Last post | 2019-09-20 08:48 -0400 |
| 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.
Re: Incorrect example for `[[` command. Greg Wooledge <wooledg@eeg.ccf.org> - 2019-09-20 08:48 -0400
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2019-09-20 08:48 -0400 |
| Subject | Re: Incorrect example for `[[` command. |
| Message-ID | <mailman.597.1568983749.2190.bug-bash@gnu.org> |
On Fri, Sep 20, 2019 at 01:40:00PM +0800, hk wrote: > Description: > On section 3.2.4.2 of Bash Reference Manual, the example on* > [[...]]* (page 13 in the PDF) is incorrect. Specifically, the example say *[[ > $line =~ [[:space:]]*?(a)b ]]* will match values like *'aab'* and* > 'aaaaaab*'. But it won't. The operator is* =~*, but the operand on the > right side is a pattern while it should be a regular expression. Nice catch. Actually it's a mixture of a regular expression (the postfix * closure operator) and an extended glob (the ?() enclosing syntax). So it wouldn't work with either = or =~ . Even more subtly wrong, the sentence before the first instance of this regex-glob-thing says: any number, including zero, of space characters, zero or one instances of ‘a’, then a ‘b’ but after the regex-glob-thing, it says: That means values like ‘aab’ and ‘ aaaaaab’ will match So there's a shift in intent between a? and a+ in what's supposed to be a regular expression. Although of course the sentence is *literally* true because the regex would be unanchored, and therefore it's sufficient to match only the 'ab', and the rest of the input doesn't matter. But that's just confusing, and doesn't belong in this kind of document.
Back to top | Article view | gnu.bash.bug
csiph-web