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

Re: Patterns quoting in subscript (was: Re: PATCH: Assorted parameter stuff)



On Wed, 18 Apr 2001, Bart Schaefer wrote:


>
> You just didn't try enough backslashes yet:
>
> schaefer[507] print -r $foo[(r)\\\\\?]
> \?
>
> The reason you need five is that [...] is parsed as if double quoted,
> except that \] is magic instead of \".  Then the pattern inside it is
> tokenized by (r) before being passed to patcompile().  So it goes like:
>
>      parse        tokenize     pattern
>     \\ \\ \?  -->  \\ \?   -->   \?
>
> (In double quotes, \\ --> \ but \? --> \?.)
>

O.K., any chance to explain the above in Zsh doc?

Just to make sure that I understand:

- "as if in double quotes" means, that I cannot use "..." or '...' quoting
inside of subscript, only back-slash is possible?

- the rule for ``\\'' and ``\$'' still aplies? But ``\"'' is parsed as
*two* characters?


-andrej



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