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

Re: clarification on (#U) in pattern matching.



On 07 February 2022 at 12:15 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> I think there might be a parameter matching flag that you can
> also set that would help.  I'd have to look in more detail.

On examination, no, I don't think there is an option at the parameter level,
as opposed to the pattern match level --- and I appreciate that this
distinction, while clear in the code, isn't likely to be so obvious to a
user staring at shell code, even if parameter substitution and pattern
matching are documented separately. The doc for parameters simplify refers
to the MULTIBYTE option.

There's a limited feature to turn off multibyte counting when calculating
widths for use in padding etc. I suppose in principle that could be extended
for pattern matching, but in practice (at least without a major rewrite) all
it would do is turn off the multibyte option locally --- probably carrying over
into pattern matching, so you'd at least get consistency between the two that
way round.

There isn't a sane way to propagate the (U) flag out of the pattern code
back up into the parameter level.

pws




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