Re: Incorrect example for `[[` command.

2019-09-22 Thread Chet Ramey
On 9/21/19 5:34 AM, Ilkka Virta wrote: > On 21.9. 03:12, hk wrote: >> Thanks for the reply. I was wrong in my report. It does match values like >> aab and  aab  in its original form. > > In some systems, yes. (It does that on my Debian, but doesn't work at all > on my Mac.) > >> It is

Re: Incorrect example for `[[` command.

2019-09-21 Thread Chet Ramey
On 9/20/19 8:12 PM, hk wrote: > What is wrong is the description `zero or one instances of 'a''. But if we > correct the right hand side word to be  `[[:space:]]*(a)?b' that it does > match what the description says.(the parenthese around `a' could be omitted). Yeah, that's the typo. > I was

Re: Incorrect example for `[[` command.

2019-09-21 Thread Ilkka Virta
On 21.9. 21:55, Dmitry Goncharov wrote: On Sat, Sep 21, 2019 at 12:34:39PM +0300, Ilkka Virta wrote: [[:space:]]*?(a)b isn't a well-defined POSIX ERE: 9.4.6 EREs Matching Multiple Characters The behavior of multiple adjacent duplication symbols ( '+', '*', '?', and intervals)

Re: Incorrect example for `[[` command.

2019-09-21 Thread Dmitry Goncharov via Bug reports for the GNU Bourne Again SHell
On Sat, Sep 21, 2019 at 12:34:39PM +0300, Ilkka Virta wrote: > [[:space:]]*?(a)b isn't a well-defined POSIX ERE: > >9.4.6 EREs Matching Multiple Characters > >The behavior of multiple adjacent duplication symbols ( '+', '*', '?', >and intervals) produces undefined results. > >

Re: Incorrect example for `[[` command.

2019-09-21 Thread hk
Thanks. Have learnt a lot from your replies. On Sat, Sep 21, 2019 at 5:34 PM Ilkka Virta wrote: > On 21.9. 03:12, hk wrote: > > Thanks for the reply. I was wrong in my report. It does match values like > > aab and aab in its original form. > > In some systems, yes. (It does that on my

Re: Incorrect example for `[[` command.

2019-09-21 Thread Ilkka Virta
On 21.9. 03:12, hk wrote: Thanks for the reply. I was wrong in my report. It does match values like aab and aab in its original form. In some systems, yes. (It does that on my Debian, but doesn't work at all on my Mac.) It is syntatically correct as a regular expression.

Re: Incorrect example for `[[` command.

2019-09-20 Thread hk
Thanks for the reply. I was wrong in my report. It does match values like aab and aab in its original form. What is wrong is the description `zero or one instances of 'a''. But if we correct the right hand side word to be `[[:space:]]*(a)?b' that it does match what the description

Re: Incorrect example for `[[` command.

2019-09-20 Thread Ilkka Virta
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

Re: Incorrect example for `[[` command.

2019-09-20 Thread Chet Ramey
On 9/20/19 9:30 AM, Ilkka Virta wrote: > On 20.9. 15:48, Greg Wooledge wrote: >> but after the regex-glob-thing, it says: >> >>    That means values like ‘aab’ and ‘ aab’ will match >> >> So there's a shift in intent between a? and a+ in what's supposed to be >> a regular expression.  Although

Re: Incorrect example for `[[` command.

2019-09-20 Thread Chet Ramey
On 9/20/19 1:40 AM, hk wrote: > Bash Version: 5.0 > Patch Level: 0 > Release Status: release > > 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 ]]*

Re: Incorrect example for `[[` command.

2019-09-20 Thread Ilkka Virta
On 20.9. 15:48, Greg Wooledge wrote: but after the regex-glob-thing, it says: That means values like ‘aab’ and ‘ aab’ 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

Re: Incorrect example for `[[` command.

2019-09-20 Thread Greg Wooledge
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* >

Incorrect example for `[[` command.

2019-09-20 Thread hk
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux hk 4.15.0-62-generic #69-Ubuntu SMP Wed Sep 4 20:55:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux