From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8270 invoked from network); 6 Apr 2000 09:16:39 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Apr 2000 09:16:39 -0000 Received: (qmail 15595 invoked by alias); 6 Apr 2000 09:16:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10533 Received: (qmail 15435 invoked from network); 6 Apr 2000 09:16:17 -0000 Date: Thu, 06 Apr 2000 10:15:50 +0100 From: Peter Stephenson Subject: Modifier substitutions. To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Message-id: <0FSL00D608EDHX@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT This is all a little inconsistent. % str="Think of a number" % old=number % new=word % print ${str:s%number%$new} Think of a word % print ${str:s%$old%$new} Think of a number % print "${str:s%number%$new}" Think of a $new Substitutions with ${.../.../...} are more consistent, though there is something a little odd with quoting in that case. For example, % str='#Think of a number' % old='#Think' % new='Despair' % print ${str/$old/$new} #Think of a number % print ${str/\\$old/$new} Despair of a number The `#' is being interpreted as an anchor at the head of the string even when buried inside $old. I have a feeling that wasn't my intention. pws