From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31524 invoked from network); 7 Nov 2022 22:16:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Nov 2022 22:16:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Subject:Cc:To:From:Date: References:In-Reply-To:Message-Id:Mime-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=HaCqUKQ4pCF+p0H9C/NFBqGhDH/gI4TxhtyhKMGwbk8=; b=IjkT79PazURUFih/qYDTElXhsu nCvcTWiIgwAeUUrrZ9pFcze17auhlk04PqfZlQbTC0v8k9LuZgE984VdcshBAIL+7597ZUevGQBsu wjoQlW/OqQtFWnLbKR1I9XZxa7KKIwmv9gJDCerQHGVI/jY0syovO9hmJvQ9huwggi7j/60QC6F6r ReMELsMAs2U07y1h/nXq+JciCnAJDk6vyjqkOR28pk9MLNwVlDdleCrO2jKAyolbyvv/Madfisu8B IiYhEq/YgaIXu1gytM1aUbPacHTmZR3zcZH5Vx5B/dlmygnjmvRFuEQqZwOcDX/t5GqCLZcK2RESA iFWBxuuQ==; Received: by zero.zsh.org with local id 1osAQD-000AOO-T6; Mon, 07 Nov 2022 22:16:49 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1osAPe-0009ej-SU; Mon, 07 Nov 2022 22:16:15 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 543B927C0054; Mon, 7 Nov 2022 17:16:13 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Mon, 07 Nov 2022 17:16:13 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvdekgdduheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderreejnecuhfhrohhmpefnrgif rhgvnhgtvgcugggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqnecugg ftrfgrthhtvghrnhepleekheejgfdufeegkeeugedugefhvedvleejheeiueffheevjefg heethfduvefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheplhgrrhhrhihvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeh udekjeejtdegqdduudelvdejfeekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrsh htmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 269FE31A0063; Mon, 7 Nov 2022 17:16:13 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-Id: <35e0a559-c6dd-41c2-a264-3e9d4846979e@app.fastmail.com> In-Reply-To: References: <9bc02014-76ca-b2c0-5f7c-284b90884225@eastlink.ca> Date: Mon, 07 Nov 2022 17:15:37 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Ray Andrews" Cc: zsh-users@zsh.org Subject: Re: [[ 'abcde' =~ (#i)Bcd ]] Content-Type: text/plain X-Seq: 28330 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Mon, Nov 7, 2022, at 4:47 PM, Ray Andrews wrote: > On 2022-11-07 13:26, Roman Perepelitsa wrote: >> [[ 'abcde' =~ (#i)Bcd ]] && echo match3 > >> (#i) only works with pattern matching. > > But isn't that a pattern match? No. It is a regular expression match. When discussing shells and adjacent tools, "pattern" almost always implies the syntax used for filename generation, or an extension thereof. (I only say "almost" as a hedge.) > [[ 'abcde' = (#i)ABcde ]] && echo match2 > > ... that seems happy so it would seem that wildcards aren't required. They are required if you want a partial-length match. % [[ abcde = (#i)ABcde ]]; print $? 0 % [[ abcde = (#i)Bcd ]]; print $? 1 % [[ abcde = (#i)*Bcd* ]]; print $? 0 >> In this specific case it's better to use pattern matching of course: >> >> [[ $foo == (#i)*abc* ]] && echo match >> > That's what puzzles me I expect: > > [[ $foo == (#i)*abc* ]] && echo match > > and: > > [[ $foo =~ (#i)abc ]] && echo match > > ... to be exactly the same. If not, why not? Glob qualifiers only work with globs. Regular expression matching is done using an external library (either PCRE or the host regex library). These libraries can hardly be expected to understand zsh glob qualifiers. -- vq