Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Don't use =~ for simple prefix match
- X-seq: zsh-workers 40783
- From: Sebastian Gniazdowski <psprint3@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: Don't use =~ for simple prefix match
- Date: Mon, 06 Mar 2017 23:01:18 -0800
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=4HtJnPXmtDGK7pLjnhB1o7Pzpz 4=; b=MHpQBoRQN16zaWuDJKnYEj6ExV5vWIaYLOYN2goCzF6dtS0xS9NTZ/nAms KSewFUMai6tEnIwZbRFJyDp8VkMMuwc9ceUMJIHl4t9u/ZLpxpnGKSmTgePMIetK DOcR0TqX5I5cpAyAGk6hg4Tm324RdHE5nWU/bDcMEEGZj2S/c=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=smtpout; bh=4H tJnPXmtDGK7pLjnhB1o7Pzpz4=; b=j7SjWkmTqZnVML+hVc2wwbE8q9fo10EOcI 5R6wcyqehwi62u8AKaMtnv3FqxdMYYY/hUPy4hCSqjbYRhF4wxsF8Kn/0oMWm1Jm +Fb4xjUz8bsDp8hNY8xec6ht23W39SIbFQKvwmHHhIlJmI8l3hAiqbiTz2EuRx0A f3n5fc8VE=
- In-reply-to: <1488869415.4132903.902877024.7D41352B@webmail.messagingengine.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170307021849.11740-1-mikachu@gmail.com> <1488869415.4132903.902877024.7D41352B@webmail.messagingengine.com>
One thing, (#b) needs extendedglob, not sure if completion provides it.
However the code was already in anonymous function, so "setopt
localoptions extendedglob" can be easily added.
--
Sebastian Gniazdowski
psprint3@xxxxxxxxxxxx
On Mon, Mar 6, 2017, at 10:50 PM, Sebastian Gniazdowski wrote:
> Did similar for _hosts:
>
> - elif [[ $host =~ "\[(.*)\]:\d*" ]]; then
> - khosts+=$match
> + elif [[ $host = (#b)*\[(*)\]:[[:digit:]]#* ]]; then
> + khosts+=${match[1]}
>
> Also localized match parameters.
>
> Had to add wrapping stars because =~ matches substrings.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author