Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: echo $fred:s/str1/str2/
- X-seq: zsh-users 8845
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: echo $fred:s/str1/str2/
- Date: Tue, 17 May 2005 14:00:18 +0100
- In-reply-to: Message from zzapper <david@xxxxxxxxxx> of "Tue, 17 May 2005 13:31:09 BST." <7poj81po8fr55i9k6h6as8s6uco3jnre9c@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <7poj81po8fr55i9k6h6as8s6uco3jnre9c@xxxxxxx>
zzapper wrote:
> echo $fred:s/bu/hhh/
>
> I don't seem to be able to use regexp's in the substitute tho' it's suggested
> that it's possible in
> the doc
You can't use patterns with that form, which is the history modifier
syntax. You can use patterns with this form:
echo ${fred/bu/hhh}
A useful trick with this form if you need to manipulate the matched
part is to use the (#m) extended globbing flag and the $MATCH variable:
% fred="hello harry"
% print ${fred//(#m)[aeiou]/${(U)MATCH}}
hEllO hArry
pws
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author