Re: Regex matching oddity (bug, or 'unexpected feature' or...?)
From:
pk
Subject:
Re: Regex matching oddity (bug, or 'unexpected feature' or...?)
Date:
Thu, 28 May 2009 22:45:51 +0200
On Thursday 28 May 2009 22:38, pk wrote:
> Yes, if the second argument is quoted, it's treated as a literal string.
> If you want the regex behavior, you should not quote it:
>
> if [[ "$Var" =~ +([:digit:]) ]]; then .
>
> That behavior changed at some point during 3.2 (too lazy to check now).
Actually, that happened in 3.2-alpha:
f. Quoting the string argument to the [[ command's =~ operator now forces
string matching, as with the other pattern-matching operators.