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

Re: Beginning of line matching



"Bart Schaefer" wrote:
> On Mar 26, 12:31pm, Ian Lynagh wrote:
> } 
> } I would have expected ${FOO/(#s)/X} and ${${FOO/(#m)(#s)?/X$MATCH}:-X}
> } to be equivalent, but it seems that only the second one has the desired
> } effect when FOO is not empty. Is there a reason the first doesn't behave
> } as I expected?
> 
> AFAICT, it's because "start of string" is considered to begin with the
> first real character, thus after the implicit intial empty substring.

Probably because of the special handling of parameter
substitution/head/tail matches, which are a little different from normal
pattern matches, where it seems to work.

I'm away for a week, so I'll have a look when I get back.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



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