From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15179 invoked by alias); 6 May 2015 07:25:54 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20180 Received: (qmail 6754 invoked from network); 6 May 2015 07:25:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7xjJ2m65ed7/r7Fgv50s+KEPP96kenzPpqzqIsBTbE8=; b=r0yVbl3O7ZXzSZzcsHpJYt4v2x652+nnm1w1MS0IC6IHbbVfr7ndJgx0C6vPHCTnMc Epsb4pQFilxKpoyqDsw1oUudKVNn6UuR6yUilBDVlHDiV2dVTqd8s0SkzoYdI5XU7SuR Ps2/Z/7qcSAQjEr85PUGTiD/VmlGI+LqYG0hYXnkFzTq2OKrGED71p//mmrSOpg1Sd1p 6RGe5jbgm98F185puqUEsre5FTpMDLHnUDNcCEJqfJgwUqiebvq48yIhawj5gRc58m5i jwM6m5nq0ovPV20wtzxYAl5eiVQTecaz028tn1FTzrZgepaJo3nQ8w4qjzv2imMq8g2U q7AA== MIME-Version: 1.0 X-Received: by 10.112.171.68 with SMTP id as4mr27472014lbc.64.1430897146584; Wed, 06 May 2015 00:25:46 -0700 (PDT) In-Reply-To: <150506000620.ZM19100@torch.brasslantern.com> References: <150506000620.ZM19100@torch.brasslantern.com> Date: Wed, 6 May 2015 09:25:46 +0200 Message-ID: Subject: Re: Splitting on unquoted equals From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: Zsh Users Content-Type: multipart/alternative; boundary=001a11c38d1a21e3bf051564b4fe --001a11c38d1a21e3bf051564b4fe Content-Type: text/plain; charset=UTF-8 Thank you. Your alternative approach works brilliantly for my problem. On Wed, May 6, 2015 at 9:06 AM, Bart Schaefer wrote: > On May 6, 8:28am, Jesper Nygards wrote: > } > } Is there a way to say "split on '=' but not within quotes", similar to > the > } way (z) treats white space? > > Not really. (z) works because it "understands" shell syntax. You are > asking for the shell to "understand" HTML syntax. It does not. You > have two choices: > > (1) Write an actual HTML element parser, in shell script. (Probably > easier to use Perl HTML::Parser or similar.) > > (2) Approach the problem differently. For example, if you first split > on double-quotes and spaces and then strip off trailing equal signs: > > torch% print -l ${${=${(s'"')mystring}}%=} > name > myelement > url > http://site.com/path/config?myname=user > > > > Curious aside - this doesn't work: > > torch% print -l ${(s:\":)string} > > > But you can't use an un-escaped quote mark there either: > > torch% print -l ${(s:":)string} > braceparam dquote> > > -- > Barton E. Schaefer > --001a11c38d1a21e3bf051564b4fe--