Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (r) flag on scalar
- X-seq: zsh-users 19984
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-user <zsh-users@xxxxxxx>
- Subject: Re: (r) flag on scalar
- Date: Sun, 8 Mar 2015 19:56:42 -0700
- In-reply-to: <20150308233821.GB2746@localhost.localdomain>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20150308233821.GB2746@localhost.localdomain>
On Mar 9, 7:38am, Han Pingtian wrote:
} Subject: (r) flag on scalar
}
} I think below command line should give result "bc", but:
}
} localhost% s=abcdefg
} localhost% print $s[(r)bc]
} b
} localhost%
}
} Looks like this isn't intuitional.
$s[(r)bc] is a single index, so it's the index where the first match for
"bc" begins.
$s[(r)bc,(r)ef] is a range of indices, so it begins where "bc" begins and
ends where "ef" ends.
The only thing not quite intuitive about this is that a wildcard (either
* or with extendedglob ?# ) at the end of the ending patterrn is not
considered part of the match for (r) but is part of the match for (R).
PWS's latest doc tweak still doesn't explicitly describe that.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author