Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ksX-Mailer: MH-E 8.6; GNU Mailutils 3.2; GNU Emacs 24.5.1



On Sep 9,  9:51pm, Phil Pennock wrote:
}
} On 2017-09-09 at 17:00 +1700, jdh wrote:
} > Is this a a feature or a bug?
} 
} Both, I think?

Well, not exactly.

} It's because those are pattern characters, thus the `*` matching the
} first item and returning `1`.  So I'd _expect_ that using the `e` flag
} too would resolve it, but it only fixes two of those.

Hrm.  The doc explicitly says:

  ... To match the value
  of a parameter literally in a reverse subscript, rather than as a
  pattern, use `${(q)NAME}' (*Note Parameter Expansion::) to quote the
  expanded value.

However:  All that the (e) flag actually does is untokenize() the
string that was previously tokenized for the (i) flag.  The string
is still thereafter passed through patcompile() and matched as a
pattern against the value.

Interestingly,

torch% print $chrtab[(i)#]    
1
torch% print $chrtab[(ie)#]
5

I don't know why a pattern consisting of an UNtokenized "#" compiles
into something that _doesn't_ match a literal "#".



Messages sorted by: Reverse Date, Date, Thread, Author