[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DEL character treated specially when preceded by a backslash when us
From: |
Chet Ramey |
Subject: |
Re: DEL character treated specially when preceded by a backslash when used in the RHS of the regex operator ([[ $'\177' =~ $'\\\177' ]]) |
Date: |
Fri, 17 Jan 2014 08:53:07 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
On 1/17/14 8:01 AM, Greg Wooledge wrote:
> On Thu, Jan 16, 2014 at 03:46:38PM -0800, Eduardo A. Bustamante López wrote:
>> [[ $'\a' =~ $'\a' ]] -> 0
>> [[ $'\a' =~ $'\\\a' ]] -> 0
>> [[ $'\a' =~ $'\\[\a]' ]] -> 1
>> ---
>> [[ $'\177' =~ $'\177' ]] -> 0
>> [[ $'\177' =~ $'\\\177' ]] -> 1
>> [[ $'\177' =~ $'\\[\177]' ]] -> 1
>
>> Notice that only $'\177' seems to fail in the middle case, while the
>> others work just fine.
>
> Maybe I'm missing something, but why do you consider that to be wrong?
> I would expect [[ x =~ yx ]] to fail (return 1) every time.
There is a question about the correct behavior when y == '\', since the
backslash is special to pattern matching. When matching a pattern or a
regexp, do you think x =~ \x should succeed, because the backslash acts
as an escape?
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/