[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[minor] [[ "\\" =~ [^]"."] ]] returns false
From: |
Stephane Chazelas |
Subject: |
[minor] [[ "\\" =~ [^]"."] ]] returns false |
Date: |
Fri, 16 Sep 2016 18:42:37 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
That's a special case of the
[[ "\\" =~ ["."] ]]
returning true (because bash called regcomp("[\\.]") instead of
regcomp("[.]") I had reported some time ago and was then fixed.
Here. It's similar:
$ bash -c '[[ "\\" =~ [^]"."] ]]' || echo unexpected
unexpected
$ ltrace -e regcomp bash -c '[[ "\\" =~ [^]"."] ]]'
bash->regcomp(0x7ffc146e78c0, "[^]\\.]", 1) = 0
I suspect bash thinks the first "]" closes the bracket
expression and thus assumes the "." is outside them so needs to
be escaped for the RE engine as it's quoted in the bash RE.
--
Stephane
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [minor] [[ "\\" =~ [^]"."] ]] returns false,
Stephane Chazelas <=