From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 690 invoked by alias); 24 Dec 2015 05:01:23 -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: 21102 Received: (qmail 8595 invoked from network); 24 Dec 2015 05:01:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=5YLCOXcRRitCzZP0xGaDDnh3g64P1EJfJ+zwpKYJdwU=; b=ivqT6qFjRXfD70xCI7MbCo2jEe8UA8l3J6jqR8q5x1b+NXlKqmlrlVHUQvLgyG2xuA VIGGOsHKfjYsfWHe99yBtAurQrrG3DJ63pMJwFXtMCQ2QZVP+VnjmbeOdSvbL0FgHoNR EGum8jYEVMjAbHDiEBrSkmA1MhpiCQCJoxpQCYNE4r2umetmWvmfcW9GA0yidyLTbaN6 Ki2JyJW/Fqxp9PFjAUS8lmTPfX6XKOVFLrqIO4Vmvd02912bkRN5QG4EpD7YCdLmUm7l csQddlRtNiMHX83pGo2p6hw8g/WzFZSpQU3Nznams7rTv0HdNjwTsmPRRcJHMJRW1mEa PGeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=5YLCOXcRRitCzZP0xGaDDnh3g64P1EJfJ+zwpKYJdwU=; b=meq1cagpZ7LNivaXERq2DgOX7NWHKUJvi4tY8GO7MknSJRDZQZNcIoSPAIO3atGOVy YWvbmf7ZiZxXdvDr1B7FgordQ+Ala+c4vr8zGHy50g9bUE/yG2hR89x53DWyYT8KPkJZ TQ4Jc4ci4QE4HOY9jASVHjYh/y0np1+p0pBnz9UBH2pntxP79eZeDjlsysxlDJEXjJig avMKFklJYO+P/pIpDSf0mMgnyKBA4UgVrxDpjfQicfhf/t9ejJ869acdaENFmqTGD1Mr G6ApUGsHD+hZMw+ttBLDBTZo+IeJe7RDkcsWee8uHogvSjZk9HNOBDkeacq7wTrQcXaq ZChQ== X-Gm-Message-State: ALoCoQk606Ml41d7L5k78tcxHQY6QKmMpuELGztAevr6S3IFxehoGT2sxTuChtyA+y9K0KtJlmhE00aP11QGddhHFIGxgFA3SQ== X-Received: by 10.98.32.207 with SMTP id m76mr24514663pfj.52.1450933278892; Wed, 23 Dec 2015 21:01:18 -0800 (PST) From: Bart Schaefer Message-Id: <151223210157.ZM447@torch.brasslantern.com> Date: Wed, 23 Dec 2015 21:01:57 -0800 In-Reply-To: <20151223232519.GA9602@chaz.gmail.com> Comments: In reply to Stephane Chazelas "Re: Example of use of (S) flag" (Dec 23, 11:25pm) References: <20151223232519.GA9602@chaz.gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Example of use of (S) flag MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Dec 23, 11:25pm, Stephane Chazelas wrote: } Subject: Re: Example of use of (S) flag } } 2015-12-23 19:25:05 +0100, Sebastian Gniazdowski: } > Hello, } > completion says that (S) is "search substrings in #, %, / } > expressions". Can someone provide example of (S) influence? Thanks } [...] } } $ a=ababa } $ echo ${(S)a#b} } aaba } $ echo ${(S)a%b} } abaa Note also that ${(S)var:#pat} is not useful; pat must still match the entire value of $var (or an element of $var in the array case) for the element to be matched/removed. Further note that (MS) is sort of a dumbed-down form of backreferences, returning something similar to the value of $MATCH in an extendeglob pattern that uses (#m) (except extendedglob is not needed). E.g.: % a=abcba % echo ${(MS)a#b?} bc % echo ${(MS)a%b?} ba Here are some examples of the use with ${var/pat/repl}: torch% echo ${a/b*/x} ax torch% echo ${(S)a/b*/x} axcba torch% echo ${(S)a//b*/x} axcxa