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

Re: [[ 'abcde' =~ (#i)Bcd ]]




On 2022-11-07 13:50, Lawrence Velázquez wrote:
I concur with Roman. I doubt you actually need case-insensitive
regex.

I'm happy with what I've got working at the moment tho you guys would probably improve it.  Pardon my personal jargon but:

local vvar=$( basename $cc[$aa] 2> /dev/null )

if   [[ "$scope_msg" = 'BROAD' && $vvar = (#i)*$filter* ]]; then
elif [[ "$scope_msg" = 'Case INsensitive TAME' && $vvar:u = $filter:u ]]; then
elif [[ "$scope_msg" = 'Case Sensitive WILD' && $vvar =~ $filter ]]; then
elif [[ "$scope_msg" = 'EXACT' && $vvar = $filter ]]; then
else cc[$aa]=
fi

... the function let's me search for directories with automatic wildcards and/or case sensitivity  or both or neither.  The four combinations seem well handled above.  The construction is still clumsy, I'll fix it shortly.






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