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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16118 invoked from network); 8 Nov 2022 13:33:10 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 8 Nov 2022 13:33:10 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1667914390; b=BU1DsZlZ+ek1EHZcfgTftIJRt0/XotiP88EibMqGhTX9TWLdVv/hOmoNndT2L6xYIRuUeUoed1 Yl6LkSCUxIiBNxtSLLh912Qw/lg9TP11XQsmLIRPrs4uymS1rfMyyBewErtn5AiGBlSfT4e+h4 vLnUeARVkzszP1//DU4beccqwJE585T+3XzPxz+o645rNTTW+regu1ecfHWHeEy+Fr1cpYADNx /jJg8XqNUmCclRe9DfeZ9guH7ZdhFfpPSuHEkkMsOxQQvHP36anb7GuMLR9ef1SvXVDrSin+Ej s80iytdKa0LbEyLImhAPbEG5Ky28JNSO0pS3ynJQSvk8Aw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1667914390; bh=AwDVXens4ID3O4Zb2bgjLku6OiqNgM/8FmpQoEabLS0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=FJBZbv+nKahpGi3+eOpy3dq3y1vPEfcFvUIDPjT7b6w06/4ovGFT2FllMx0kp0nx2SVYQnLyl1 3AtK0sg1vJivKaQDkxNnEO6qAXmIu9oJ1uZMC9FDUwmKolZ+307RtQiYQnnFPG/cldgQC2spy+ cE3Jifl/nPyjc5Lj6pRjkQ49oNwFTIsD6SycaGyBB7hVPqEotMGi9FWHMst8apYZj0iDdCVne3 UaeoMWFYHO2ltXiVgGSrfaiVqMpE6g+A9EN5ixOPuVgW5YjCzFdzzTGNLRUnuzwv39pm+KB1Z9 wjMYKb61Y/pK62jZWOHvncxpSxMgS8uqKZHp9cuVYZy/cg==; 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-transfer-encoding: Content-type:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=eYnV5RwyP9VWCtqY5e8KH2Da8XTJQBmXVJAQ/ZbUuAE=; b=UnRYEEYmq2IoE9WrZF5YuFN6tI mcRe8rPZuz3XB3kPNjQ2Cw79hsm8rUDDFgngW8UGwA0KqHRWBbCuZVn7H1XywBBncaFJmU0N8cQdC QW6VppxuSQsfRY9ZfCKfOC4E4xERk9IMhiQNduN76x0+JuSfWkQwSNLf3dWGZVnapfYHjofbqDk0u oW403kjdFuUSyktKGM+HxGIPHY2WAUc++yGyOMi0UA3iCqxtg2P+ub0we2JcJKjU++GjJvNtpBHYZ K4259pwFjwJajdHzbDvO4Z6Zg3OpvcORXvbBW1bdU1mYPXs+BQk8393WKHL2yb1GUTnxokHTPgWNp 5XfpPmjA==; Received: by zero.zsh.org with local id 1osOj0-000M1t-Aj; Tue, 08 Nov 2022 13:33:10 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:43499) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1osOi4-000LI9-4W; Tue, 08 Nov 2022 13:32:12 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RL100DC14XQG2R1@mta02.eastlink.ca> for zsh-users@zsh.org; Tue, 08 Nov 2022 09:32:10 -0400 (AST) Received: from [192.168.0.3] ([24.207.18.108]) by Eastlink with ESMTPSA id sOi1oyStDXZnZsOi2oN5Cc; Tue, 08 Nov 2022 09:32:10 -0400 X-Authority-Analysis: v=2.4 cv=I9+jBvsg c=1 sm=1 tr=0 ts=636a5a5a a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=bLYz6BjO3r-Sr8-imiwA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfedtgdehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeeitdejffevgfdtheeggfetkeeugeegieetuddtvddvudetteffvdevlefgueekudenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrdefngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <4ab5bc12-7b60-0478-8b79-72e3319dcb64@eastlink.ca> Date: Tue, 8 Nov 2022 05:32:09 -0800 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [[ 'abcde' =~ (#i)Bcd ]] To: zsh-users@zsh.org References: <9bc02014-76ca-b2c0-5f7c-284b90884225@eastlink.ca> <15a3af0a-87ad-49f8-ab9f-baa240e205f6@app.fastmail.com> <29b06e8a-e58a-91c6-985d-64020727d603@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28339 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: >> local vvar=$( basename $cc[$aa] 2> /dev/null ) > There is a zsh way for this: > > local var=${cc[$aa]:t} > > "t" is short for tail. There is also "h" for head. Thanks yes, I knew zsh could do it, the use of basename was just a fill-in.  Anyway you did the work for me just there.  But I was going to pattern match, seems as usual zsh has a better way. > Here WILD suggests a wildcard (a.k.a. glob, a.k.a. pattern) match, but > the code is doing a regex match. If your intention is to perform a > wildcard/glob/pattern match, do this: Thing is that I need both.  Sometimes I'm searching for directories in a saved list, sometimes searching out there in the real world of globbing the filesystem.  What I showed was the search in the saved list.  My directory stack is file based, universal and persistent sorta like the history list but sometimes I want to go looking out on the FS too.  So yeah, 8 combinations :(  You'd think it might be four since in the mind it feels like a text search in both situations. > > There might be a better way to do this which would take advantage of > **/*. It's hard to say without knowing what you are trying to achieve. It's a directory 'cd' from my personal stack sent to Sebastian's n_list() for graphical selection.  I can't live without it.  But I decided to add live 'cd' from the entire filesystem filtered via arguments and, as above, the four combinations and as you anticipate I ran into the mud expecting the syntax for the four combinations in the latter situation to be the same as the former but the latter is 'live globbing' whereas the former is just pattern matching in the lines of a file so they are chalk and cheese.   It seems to be working but there's always the next gotcha:     1 /aWorking/Zsh/Source/Wk 0 $ . c; c ,a zsh     Searching entire system for directories matching "zsh" (BROAD): ... gives this n_list() screen: ------------------------------------------------------------------------------------------------------- : Most recently visited directories matching "zsh" (BROAD): /aWorking/Backup/Zsh /aWorking/Zsh-55555 /aWorking/Zsh /usr/share/zsh /aWorking/garbageZSH /aWorking/Zsh/Zsh-5.8 /usr/share/doc/zsh-common : System wide directories matching "zsh" (BROAD): /aMisc/Backup-root-2022-10-11/.thunderbird/i3n1gea2.Default User/Mail/Local Folders/ZSH.sbd /aWorking/Backup/Zsh /aWorking/Backup/Zsh/Zsh-5.8 /aWorking/Backup/Zsh/Zsh-5.8/share/zsh /aWorking/garbageZSH /aWorking/Zsh /aWorking/Zsh-55555 /aWorking/Zsh/Zsh-5.8 /aWorking/Zsh/Zsh-5.8/share/zsh /etc/zzsh /root/.thunderbird/i3n1gea2.Default User/Mail/Local Folders/ZSH.sbd /usr/lib/x86_64-linux-gnu/zsh /usr/lib/x86_64-linux-gnu/zsh/5.8/zsh /usr/local/share/zsh /usr/share/doc/zsh /usr/share/doc/zsh-common /usr/share/zsh /usr/share/zsh/functions/Completion/Zsh ------------------------------------------------------------------------------------------------------------- ... cursor up,  cursor down, pick a directory, press ENTER and you're there automagically. Or I can demand an exact search (no card sharping, no advice on how to be insensitive): 1 /aWorking/Zsh/Source/Wk 0 $ . c; c ,Xa zsh Searching entire system for directories matching "zsh" (EXACT): ------------------------------------------------------------------------------------------------------------------ : Most recently visited directories matching "zsh" (EXACT): /usr/share/zsh : System wide directories matching "zsh" (EXACT): /aWorking/Backup/Zsh/Zsh-5.8/share/zsh /aWorking/Zsh/Zsh-5.8/share/zsh /usr/lib/x86_64-linux-gnu/zsh /usr/lib/x86_64-linux-gnu/zsh/5.8/zsh /usr/local/share/zsh /usr/share/doc/zsh /usr/share/zsh -------------------------------------------------------------------------------------------------------------------- ... so far, so good.