bug-bash
[Top][All Lists]
Advanced

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

Re: bash-4.3.33 regexp bug


From: Stephane Chazelas
Subject: Re: bash-4.3.33 regexp bug
Date: Thu, 5 Mar 2015 17:26:00 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2015-03-05 12:14:21 -0500, Greg Wooledge:
> On Thu, Mar 05, 2015 at 05:07:44PM +0000, Stephane Chazelas wrote:
> > bash also supports \s, but that's more for [[:space:]] (so
> > includes vertical spacing like CR, LF), and you need to use an
> > intermediary variable:
> > 
> > r='^some text:\s+([0-9.]+)'
> > [[ $s =~ $r ]]
> 
> Woah!  What?  Where is *that* documented?  The only \s in the man page
> is in PS1.

The bash manual only points to regex(3).

So it's down to your system's regex library (uses
regcomp(REG_EXTENDED)) which on recent GNU systems supports \s.

The need for the intermediary variable is down to the broken way
bash tries to overload \ as a quoting operator and regexp
operator since bash-3.2.

-- 
Stephane



reply via email to

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