[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash-4.3.33 regexp bug

From: Chet Ramey
Subject: Re: bash-4.3.33 regexp bug
Date: Fri, 06 Mar 2015 11:41:52 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 3/5/15 9:51 AM, Eduardo A. Bustamante López wrote:
> On Thu, Mar 05, 2015 at 02:26:48PM +0000, Jason Vas Dias wrote:
>> Good day list, Chet -
>> I think this is a bug:
>> ( set -x ;  tab=$'\011';  s="some text: 1.2.3";
>>   if [[ "$s" =~ ^some text:[\ $tab]+([0-9.]+) ]]; then
>>     echo "${BASH_REMATCH[1]}";
>>   fi
>> )
>> -bash: syntax error in conditional expression
>> -bash: syntax error near `$tab]+([0-9.]+)'
> From a quick glance, it does seem like a parsing bug, it should not break with
> a syntax error.

It's not a bug; the space between ^some and text needs to be escaped
somehow to prevent it breaking words.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]