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