Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to best match $( ... ) in a string
- X-seq: zsh-users 23417
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: How to best match $( ... ) in a string
- Date: Fri, 1 Jun 2018 10:50:16 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180601095021euoutp020686072bf99cb34521ad8cb6cd6939c6~0AGg8o-Gb3223532235euoutp02V
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1527846621; bh=WHMLtCq+05gzH2uGA8FtfcygjkJ3pMtVzawwTmLgP/8=; h=Date:From:To:Subject:In-Reply-To:References:From; b=qnlCAl8lSQjlVplUjO8jtq+HKbRWGqSCEeUzBKtz9227e9JcnPl+AiumvGZs9E0yX g+r76GyvL70A66FhsDD+PxCGwu7XwLWtcCR1q+x7jhno4HCl8WNl7tSAoW6njFFL7a K4sPw/zmnqnpyQ8VKRG6IC0/uzSYaOcUIXFN82bg=
- In-reply-to: <CAKc7PVANEoKJ0-R0i_zr6PoZYgzP8hYAtrTeyEKM-o4HoBr1rQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: SCSC
- References: <CGME20180601084641epcas5p1ca4cd48fa463123bbe980d132fd19473@epcas5p1.samsung.com> <CAKc7PVANEoKJ0-R0i_zr6PoZYgzP8hYAtrTeyEKM-o4HoBr1rQ@mail.gmail.com>
On Fri, 1 Jun 2018 10:44:58 +0200
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> the problem is possible quoting, e.g. $( echo \) ). Has anyone a
> pattern that would handle some sort of quoting?
In general, this isn't possible. Apart from nested unquoted
$(...), which is also valid, the real killer is
echo $(case foo in
foo) echo This does work
;;
esac)
This required us to rewrite our internal parsing completely and we're
still shaking the odd bug out of the result.
If you ignore that case, it's possible character by character with
a bit of extra state for quotes, nested parentheses, etc. (as that's
what zsh did for two decades) but you're going to need some incredibly
sophisticated regular expression involving recursion to replace that.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author