diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-05-21 09:30:24 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-05-21 09:30:24 +0000 |
commit | faf05be3d2adc99212af74e2507a66de1161a52a (patch) | |
tree | 7a0ac19d76eff3142484c02a83388a5e52848535 /Doc/Zsh | |
parent | 86ff81f82d97b0118eddb729a2d4956fcbdd7c7a (diff) | |
download | zsh-faf05be3d2adc99212af74e2507a66de1161a52a.tar.gz zsh-faf05be3d2adc99212af74e2507a66de1161a52a.tar.xz zsh-faf05be3d2adc99212af74e2507a66de1161a52a.zip |
23440: Make $param[(R)value] substitute the empty string on failure
Diffstat (limited to 'Doc/Zsh')
-rw-r--r-- | Doc/Zsh/params.yo | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index 6f134baa2..f839ec880 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -234,15 +234,7 @@ item(tt(R))( Like `tt(r)', but gives the last match. For associative arrays, gives all possible matches. May be used for assigning to ordinary array elements, but not for assigning to associative arrays. - -Note that this flag can give odd results on failure. For an ordinary array -the item substituted is that corresponding to subscript 0. If the option -tt(KSH_ARRAYS) is not in effect, this is the same as the element -corresponding to subscript 1, although the form tt(${array[(I)pattern]}) -will evaluate to 0 for a failed match. If the option tt(KSH_ARRAYS) is in -effect, the subscript is still 0 for a failed match; this cannot be -distinguished from a successful match without testing tt(${array[0]}) -against the pattern. +On failure the empty string is returned. ) item(tt(i))( Like `tt(r)', but gives the index of the match instead; this may not be @@ -251,13 +243,16 @@ behaves like `tt(r)'. For associative arrays, the key part of each pair is compared to the pattern, and the first matching key found is the result. -See `tt(r)' for discussion of subscripts of failed matches. +On failure, a value one past the end of the array or string is returned. ) item(tt(I))( Like `tt(i)', but gives the index of the last match, or all possible matching keys in an associative array. -See `tt(R)' for discussion of subscripts of failed matches. +On failure the value 0 is returned. If the option tt(KSH_ARRAYS) is in +effect, the subscript is still 0 for a failed match; this cannot be +distinguished from a successful match without testing tt(${array[0]}) +against the pattern. ) item(tt(k))( If used in a subscript on an associative array, this flag causes the keys |