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

Re: ${name/pattern/repl} with negated pattern



On May 15,  6:37pm, Roman Neuhauser wrote:
}
}     ${name/pattern/repl}
}     ${name//pattern/repl}
}       [...]
}       The pattern may begin with a `#', in which case the pattern must
}       match at the start of the string, or `%', in which case it must
}       match at the end of the string, or `#%' in which case the pattern
}       must match the entire string.

Indeed, I'd forgotten about that.  Still:

torch% setopt extendedglob
torch% torch% echo #foo
zsh: bad pattern: #foo
torch% print ${a:##foo}

torch% 

Evidently the syntax allowing the pattern to begin with a "#" is applied
in the name:# case as well as in the name/ case, even though it should
be meaningless for :#.



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