Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: fix for (#s) and (#e) in param substs



Peter Stephenson wrote:
>By the way, I inserted a hostage to fortune in the manual by claiming that
>`(^(#s))' etc. also work, i.e. you can assert that you are not at the start
>of the string.

Careful.  If that's been implemented correctly, `(^(#s))' will match
an arbitrarily long substring anywhere, in addition to a zero-length
substring anywhere other than the start of the string.  The semantics of
negation mean that it will match any substring other than what `(#s)'
will match; i.e., it will match anything except for a zero-length
substring at the start of the string.  The documentation should be made
clearer on this point.  We could also do with proper negative anchors,
that will match only a zero-length string in places other than the
{start,end} of the string.  Or if someone feels like implementing my
generalised anchors proposal (I don't have the time at the moment), then
`(#Aan:...)' could be used to negate the sense of an anchor.

-zefram



Messages sorted by: Reverse Date, Date, Thread, Author