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,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3996 invoked from network); 27 Jan 2023 11:48:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Jan 2023 11:48:25 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674820105; b=r5Cz2n5PvM+Hi3fMJuGByzNUOHk9O8/WbKQpRtVyMEysBeXxLJJP6pIZMFr10sTd1LedyQ8QvF Ytiv/Zqe2F/sGFdzYJmvh7J9wkbhkntWtSKIZIxlYvH0YtAc1xY3cWuevGpR7u4bXDp0PPPf8s 1NZIiZJOg/y8n4ycCrRm2IqYK+xjZD5XE+Yh2qIFBWG5zB0zWcRZ5e+qinnEdTh3PH7Bz6uvcm RJyMz3gJZDX3Uwd5FyOBI1+ecZjJZNDnrtIhZdwyitzPpM2rqUNIv3b/UXkhtBX0kfPDkW8rkM JfZxMZ4hSbliBczfluv+PD+gaBMwrAFDWNuGDEWu1gw5Sw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f52.google.com) smtp.remote-ip=209.85.167.52; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1674820105; bh=+sXMu8g2vhQ3FFbqwB8Obvw6swnqGz0t6Cja0T59fBY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=sMqbJO+pVNnDcDMlMYI1dG9BSHozjOKD/RPDc0X0e7T/+/66/Qldrec4d7dgznG5Ddg/2OGg++ XZqCODLrt7LW7c/DXe3sm7zBufb34XMtqtYoKkoKYx3szmYYXOq+vIrU3lt9gDtWzbNV+TtC+Z angwCjSLbKQeJeSwqpyQRfkU2R1M5ITW5rgtdaYDq6qd9UOVREDD52pqfu/ItBJXq7OlsvA/KJ o3ACqIDF/oIrhzE5tUk3Wby6Drkk6ALzQFwk1wToLGHnZLqQDaSdCOC29PqV//YBXAHDLfJ9iP +vIASOwvteYUHhp8KDIICkhzCOpJMiNtZQKk2fEbs/niFQ==; 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:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=+sXMu8g2vhQ3FFbqwB8Obvw6swnqGz0t6Cja0T59fBY=; b=QUsDYnn0v6qyW43y8b3extniqs R8t94lo2+ngMVJKpph/YBi44uv/f13MK4f0ei1H6mdyYnjjm9gm5kUJBmQs6lwXVMk0y50N5TrWxW tJolqaigcRkgcG6/TCKh63Zy+Chk5M1PtJsOjMj0KRngL7sI8unscE33R0MUVHUQLuZbM2dhjA8O/ c4B8rAxeA3fc38xYilZTzD0YWlWgzh8DJTXod7AXHNQYgVtGuz6PLq5j/hRV0UPBuSjhjL9MnHhOP TbIPz2RBcdNjQd5888qni01qdaZDt2pRl+ULJbB81pIrQePiORhbgda7YODdBt0aAfHiyFAKnapm3 NEq1tOXA==; Received: by zero.zsh.org with local id 1pLNDU-000Aqh-Bi; Fri, 27 Jan 2023 11:48:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f52.google.com) smtp.remote-ip=209.85.167.52; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f52.google.com ([209.85.167.52]:41564) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pLNCn-000ACF-NA; Fri, 27 Jan 2023 11:47:42 +0000 Received: by mail-lf1-f52.google.com with SMTP id d30so7719701lfv.8 for ; Fri, 27 Jan 2023 03:47:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+sXMu8g2vhQ3FFbqwB8Obvw6swnqGz0t6Cja0T59fBY=; b=ZVuO8Rr8T9pHSl5MTbO9SsdYAOYTS6LPwTICuPeUxMXO9jd0tXR6DX4Xl2V6YwEQCs LsF9aIhHMkFjGyuN5gudus69ABNJlKI2BWOECZ/xZbfbQzOhe8RMeEJCThoEIkIzBak2 JmenoP87hqN9Q11hJvhy+HYqRjQtxbwHFaqpLBCX250z88vtQ2wTvfnIfpJGx4njfBxZ hn5KtEaWCzzA97OBnfHsFdJDBf4eLr5XQMNXHXyYOPnlKl1at5EHEEfnBaX+tdaa8g8K lexxAoh0z248KZy6uHCBJDdDWl4SdB0f6vwrPucdinn0+KyQoefQ155uiFXKU1ffnAl2 Zavw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+sXMu8g2vhQ3FFbqwB8Obvw6swnqGz0t6Cja0T59fBY=; b=g5+j1Lf3EbPtHAa5kxLC7cGkn4QKFr7VjhRxYSWQAONdkpO0H2Zd7HkkzLQQnCKgGm YIuHvFIoBGNZhGxpWel1T9GNhr3MWgStCMsMMhoiJDYs/C+j9DqdmdXuBEC6DsiAVXdN ZmxdVI4nWduTs3y6jkUeggc71RQlwo9Ar3ipe7zdXMVP640p4FElTj0Dy2eu5CpYN0k8 hk8B/SHQilE8hxdsEJR97db1AroIVArIhM4sntf17p0iiJK7NICZOXcjUFotBLqrRDoS elmZS/mSFh3JlBNY+VTLpsgIUSWa6debzAUOCWySBCayqnzEBW1Cre1vmH55s0lbZOpn vgXA== X-Gm-Message-State: AO0yUKX4FONYZzXmZ9zSNJnBs3YtJjP9CiIWD5NMN5Ii+5A4mnMrucg8 kNXH2+6nToEqFK02K2Sye0/d0W3RCUF3e9xeC1EmVW7PM/k= X-Google-Smtp-Source: AK7set/AaKaNLRnIM8zFZzN26EY4FpHtgCP2FdyGBSlhOQ9YjDo3hPzEJ4lDB4IWauGIyv03s30vo/+ogglXZ4o8R0o= X-Received: by 2002:ac2:4841:0:b0:4d7:bda4:e6af with SMTP id 1-20020ac24841000000b004d7bda4e6afmr1096438lfy.184.1674820060860; Fri, 27 Jan 2023 03:47:40 -0800 (PST) MIME-Version: 1.0 From: Sebastian Gniazdowski Date: Fri, 27 Jan 2023 11:47:14 +0000 Message-ID: Subject: Possible to match string supporting backslash quoting? To: Zsh Users Content-Type: multipart/alternative; boundary="000000000000ca548205f33d6e11" X-Seq: 28826 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: --000000000000ca548205f33d6e11 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable HI, I'm matching var=3D"=E2=80=A6" and would want to support quoting, i.e.: var=3D"abc\"ef". So far I have: qstr=3D'(#B)(["](#b)(*~(*[^\\]([\\][\\])#["]*)))["]' [[ '"qqq--\\"abc"' =3D=3D (#b)$~qstr ]];printf =C2=B7ec=3D%s\\n $?;@str-dum= p match Output: =C2=B7ec=3D1 qstr=3D'(#B)(["](#b)(*~(*[^\\]([\\][\\])#["]*)))["]' [[ '"qqq--\"abc"' =3D=3D (#b)$~qstr ]];printf =C2=B7ec=3D%s\\n $?;@str-dump= match Output: =C2=B7ec=3D0 1: qqq--\"abc 2: 3: So it at least detects a \\" in the input. Would it be possible to utilize the negations ~ and ^ to somehow match "str\"ef" as: str"ef, and "str\\"ef" as: str? -- Best regards, Sebastian Gniazdowski --000000000000ca548205f33d6e11 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
HI,
I'm matching var=3D"=E2=80=A6" and woul= d want to support quoting, i.e.: var=3D"abc\"ef". So far I h= ave:

qstr=3D'(#B)(["](#b)(*~(*[^\\]([\\][\\])#["]*= )))["]'
[[ '"qqq--\\"abc"' =3D=3D (#b)$~= qstr ]];printf =C2=B7ec=3D%s\\n $?;@str-dump match
Output:
=C2=B7= ec=3D1

qstr=3D'(#B)(["= ](#b)(*~(*[^\\]([\\][\\])#["]*)))["]'
[[ '"qqq--\= "abc"' =3D=3D (#b)$~qstr ]];printf =C2=B7ec=3D%s\\n $?;@str-d= ump match

Output:
=C2=B7ec=3D0
1: qqq--\"abc
2:
3= :=C2=A0

So it at least detects a \\" in the input. Would it= be possible to utilize the negations ~ and ^ to somehow match "str\&q= uot;ef" as: str"ef, and "str\\"ef" as: str?
<= div class=3D"gmail_default" style=3D"">
--
=
Best regards,
Sebastian Gniazdowski
<= br>
--000000000000ca548205f33d6e11--