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

Re: input foo, output '[F|f][O|o][O|o]'?



On 1 Jul 2013, at 15:37, Phil Pennock wrote:

> % foo=CrashPlan
> % for c in ${(s::)foo}; do print -n "[${(U)c}|${(L)c}]";done; print
> [C|c][R|r][A|a][S|s][H|h][P|p][L|l][A|a][N|n]
> %

That works great.

Thanks!


> If this is for use within zsh, then as ZyX suggests it's simpler, even
> for regexp cases:
>
> setopt rematch_pcre
> [[ "cRAShpLAn" =~ (?i)$foo ]]

It isn't… but that's helpful for future reference.

TjL



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