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,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11193 invoked from network); 27 Jan 2023 18:48:50 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Jan 2023 18:48:50 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674845330; b=XifbBYK16RNyKrtYPZgKyy+wIF33e6/sgTdkoLP/55khZWP/18TZSuIe3rMM8XnGoDyFbAU5tQ ydIwsUlOAIr/uXO4/Mar39gFRuMnAwFz2dWSR6Fbr3n/DxfhdtBbTNEdGF7y9lbqvjJCIxVW4P uzXKar+UEvcZfoLjyexMaj/PLGffiS198BYm/bRgXSq8r551mq0kapEFItBK5X7EUq8g+FBbnc rvAPLxFiIA4n6XjUgTb3fHilr4F3NW0i2xYXy4b8GFF3rzJFb52uNeHEC8CwTG2ODtN5ZZeDdU Zbf5F24EvuEAZ33QZJL8EvjWPCnSOfVvb1lMmHqy3baq3g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout1-smtp.messagingengine.com) smtp.remote-ip=64.147.123.24; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1674845330; bh=w3imsTzwvP9fpnGWk/n8Bgp1FD9YAoEJWV7dVEnkXWs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=Y2R69bUs54y5VZ7h01vhat1p9/C300fnSsmVz4YrbcGKkxrD0QSur318Rd7mOhvR6w0DC/YF5H 3JMdMz7GJHQ9i8g7loJP0HhrkmuucjDrfumdQJopPfEzrmHqp9y0o0kMlgORuwrwp6mc0cV2kj iPoeZGIsLy69iHLbPlF0ua+CFZhILh7lxteGOaWkHKEoSPNwTZn+bTGImJCXQ4Cz3m7REDka9j wnMm0u6onXX+iP9HgzNhzbTsi5apaoiO+rhijgEtYJQZ2qndUY7xVAbJ1GHs5skZytwsaqfZ3I OPji3EIsSUDDh49Uu1fUNwogCGSIirKODbHXB+RZp4Qrgg==; 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:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=im3PUPdLiGHSmeC+DX3DDUhjTxa8b0Q3mHTaumftNH8=; b=k6rc+ScvlfWp0dW7p2DhuBP/gt garqOiNq0rLTY61S9VylCzK2VeWUhrX9BDM+YFiX1cmssPAJcnbTU19NYdwZqQ3ZqtUwTLd7LhREU VJERYWCHGWWZLfNenJpEfEBwrOU1bewDM4lq/tQ8q5Lvw9PVT1lqsNMuO4RJEpRQz8S8hytRLnL0J cFQwgNbkkLlPSf9fhe57lenPnelYBDR1plgMV24BOsEI/FOBFzEe3lhLV8J+LjgssPBCGYt6Z1iXO W1u8enkMQrGWX+1wIS2ggQ9/EoHp/DO1TqoBLWg0yDIBfK/cHxJmAK+6i28UyQt0pr0VctJSvNXmi nTItcd4A==; Received: by zero.zsh.org with local id 1pLTmL-0002IJ-V4; Fri, 27 Jan 2023 18:48:49 +0000 Authentication-Results: zsh.org; iprev=pass (wout1-smtp.messagingengine.com) smtp.remote-ip=64.147.123.24; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:33493) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pLTlr-0001xw-3r; Fri, 27 Jan 2023 18:48:20 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 1BF9C320098D; Fri, 27 Jan 2023 13:48:17 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 27 Jan 2023 13:48:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1674845296; x= 1674931696; bh=im3PUPdLiGHSmeC+DX3DDUhjTxa8b0Q3mHTaumftNH8=; b=E sJ5ZxKkwpMdSEbdJxnsfYWxBHuHz+xOZFUaxssu0M0i/WPD5ihaYH3AOoXyfCKJI /n7FJoPSyVS1/Eu64BDk7/ooXvI1zJYn9W0gaoS5eKbdurrhP0qiKje0ZAmYSdKb p63sK6qDBbPXecwQKu2SScIFCGQOXhKCtwVGCYIeep6hQPRKMEkWV8xpc/gk/WmW a6Yy5/o+1VyXhLpL5SseAwOxEXI0o1ij81EVZMd8zjxyNPUhzMCCCLkrBkMeVF32 jBpQnDtZtRp5WqtuUL3LOzRgz4r+az1Lppdam717sA0afyPPWmbpEvnW5QMvn6gt S+/ISwh2ufs6+NNXwSQ4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1674845296; x=1674931696; bh=im3PUPdLiGHSmeC+DX3DDUhjTxa8 b0Q3mHTaumftNH8=; b=CtAFsrlhnMU+cZBbPQn71GfwrQzhLOYEz6MQdC8dXoU2 vUJu0KRP0vo5eoTDvmnU2+iqgSxxUDDk/q8LDA8nyYCHBTcCOuRj57LjVX8aJ/dj 9lRk+STX6Ej42pQWXOi9Vw1VN9Xp7GZGrI4NMBa1MR25hDAfG7Jeb4GWBS9Iv7gR DrTAYI5sbDqqx/OVG2DR+mh2vuWh4FmoFsz86ekcbCvkcSIGCHZUKAs6qDNoe119 Cbkb8TfdJrmgGiX4Rs9nNwlGQpTiLj27jV/5tDdLAHdQhY10gJaAjCAZhwsV9W9+ 5WqamSuqIx35XOv/yFb+w8iTVgTYrTEQjXdzku+lwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddviedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjfgesthdttddttdervdenucfhrhhomhepffgr nhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecuggftrfgrthhtvghrnhepueelvdefteduuedtveejjefgieetkedugeeuieehveel gfeghedvgedvheffheehnecuffhomhgrihhnpehgihhthhhusgdrtghomhdprhgvghgvgi hprdhmugenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Feedback-ID: i425e4195:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 Jan 2023 13:48:16 -0500 (EST) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4P3RRL3nGHz2Yk; Fri, 27 Jan 2023 18:48:14 +0000 (UTC) Date: Fri, 27 Jan 2023 18:48:14 +0000 From: Daniel Shahaf To: Sebastian Gniazdowski Cc: Zsh hackers list Subject: Re: Pattern engine extension for \< and \> support? Message-ID: <20230127184814.GC31007@tarpaulin.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 51336 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Sebastian Gniazdowski wrote on Fri, Jan 27, 2023 at 10:01:15 +0000: > Hi, > in regexps, there are \<, \> and also \b sequences, that match zero-length > string on the word boundary. They are particularly useful for e.g.: > refactoring substitutions, like e.g.: with sed: > > sed -r -i -e 's/\/other/' > > This automatically protects pre/suffixed strings like str_myvar and > myvar_str. In mcedit, I often use \b that's available there (\< and \> do > not work), to obtain the same effect with the regex: > > \bmyvat\b > > I'm not sure if distinction of left and right boundary offered by \<, \> > actually makes a difference. > > Zsh has similar sequences already - (#s) and (#e). They do match 0=length > strings on begin or end of the matched string. So maybe the topic is known > to any implementing person? Is it hard to add such \b or \<,\> sequences? > Could it be also possible to make it backward-safe, i.e. the sequence be > ignored by proceeding Zsh versions? This happens to be covered here: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/regexp.md tl;dr For portability use RE_MATCH_PCRE.