Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Ilkka Virta Newsgroups: gnu.bash.bug Subject: Re: Incorrect example for `[[` command. Date: Sat, 21 Sep 2019 22:15:05 +0300 Lines: 29 Approved: bug-bash@gnu.org Message-ID: References: <8e7c8ea4-2fdf-4809-0b50-ea1bfbbec165@case.edu> <20190921185509.GA5480@madrid> 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 1569093323 26834 209.51.188.17 (21 Sep 2019 19:15:23 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Dmitry Goncharov 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: <20190921185509.GA5480@madrid> Content-Language: en-US X-SASI-RCODE: 200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=subject:to:cc:references:from:message-id:date:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtp; bh=EfjsqI0Uk5ZuGTcwUk2mr0M1ZE/wXPsHVdZEDH/m7Zo=; b=JaC1p8ID/wOJWXrwsAnUUy54xe3LbaYZBwZoK/C63AiPQ32VTuRxvAr6FOaojyNXLU7vHnrkEwqolfsE4rAuPsY8vGJ0ILpOCN3HSoaKzdvXzEzqWrE6sYjg+3BkYC1WxFUrO/x03e1Q75vnze3TvCbFFjrbqf+m3czra8orVKfhZS5Yl8QCTGUoXeEJxZrnPHQ8nXiAQNfifk8dbJyzlmllDdZ3dH6NUSk5/WmieFKPaZnaVpbG1fBBLGDo9lCllaK0Nz7Cr2JROTKkNMe0A615Xqm6mTYsh0nHh3lmBqLBG9p01w9fRFiVPpr2zVyh9uIWx4WOheidAHNNrYeBGA== X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 157.24.2.104 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: X-Mailman-Original-References: <8e7c8ea4-2fdf-4809-0b50-ea1bfbbec165@case.edu> <20190921185509.GA5480@madrid> Xref: csiph.com gnu.bash.bug:15396 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) produces undefined results. >> >> https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/V1_chap09.html > > This is unfortunate. > *? and +? are widely used not greedy regexes. In Perl-compatible regexes. Bash uses POSIX extended regular expressions. And on a GNU system, while *? and +? don't give errors when used in an ERE, they still don't make the repetition non-greedy. They just act the same as a single * (as far as I can tell anyway). bash$ re='<.+?>' bash$ [[ "ace" =~ $re ]] && echo $BASH_REMATCH c bash$ [[ "a<>e" =~ $re ]] && echo $BASH_REMATCH <> -- Ilkka Virta / itvirta@iki.fi