zsh-workers
 help / color / mirror / code / Atom feed
* Modifier substitutions.
@ 2000-04-06  9:15 Peter Stephenson
  2000-04-06  9:32 ` Andrej Borsenkow
  0 siblings, 1 reply; 16+ messages in thread
From: Peter Stephenson @ 2000-04-06  9:15 UTC (permalink / raw)
  To: Zsh hackers list

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2000-05-05 14:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-06  9:15 Modifier substitutions Peter Stephenson
2000-04-06  9:32 ` Andrej Borsenkow
2000-04-06 12:49   ` Andrej Borsenkow
2000-04-12 12:26   ` Should we backup this change? " Andrej Borsenkow
2000-04-12 12:34     ` Sven Wischnowsky
2000-04-12 14:53       ` Bart Schaefer
2000-04-12 15:06         ` Andrej Borsenkow
2000-04-12 20:54           ` Peter Stephenson
2000-04-13  6:00             ` Andrej Borsenkow
2000-04-13  8:59               ` Peter Stephenson
2000-05-04  7:02         ` Let's do it " Andrej Borsenkow
2000-05-04 15:56           ` Peter Stephenson
2000-05-05 13:32             ` PATCH:RE: Let's do it RE: Should we backup this change? RE: Modifiersubstitutions Andrej Borsenkow
2000-05-05 14:26               ` PATCH: substitution anchors Peter Stephenson
2000-05-05 14:52                 ` Bart Schaefer
2000-05-05 14:55                   ` Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).