Unlike, e.g., backslash references in replacement strings of sam’s substitution command, where multi-digit subexpression references would be ambigiuos, this change does not create any ambiguity that cannot be easily avoided thanks to the single-quote literal syntax.
Granted, it is backward incompatible, but I doubt anyone wrote something like …$7123… instead of …$7'123'…—to an eye used to rc variable substitution syntax (which plumbing rules deliberately resemble), the former is too uncomfortable looking, even if one knows that in plumbing rules it works slightly differently than in rc.
In subexpmatch(), we consume all the digits following the dollar sign even if the resulting number would exceed NMATCHSUBEXP (or even overflow) to avoid any potential ambiguity and bring it in line with rc behavior for such syntax.
Motivated by #565.
Unlike, e.g., backslash references in replacement strings of sam’s substitution command, where multi-digit subexpression references would be ambigiuos, this change does not create any ambiguity that cannot be easily avoided thanks to the single-quote literal syntax.
Granted, it is backward incompatible, but I doubt anyone wrote something like
…$7123…
instead of…$7'123'…
—to an eye used to rc variable substitution syntax (which plumbing rules deliberately resemble), the former is too uncomfortable looking, even if one knows that in plumbing rules it works slightly differently than in rc.In
subexpmatch()
, we consume all the digits following the dollar sign even if the resulting number would exceedNMATCHSUBEXP
(or even overflow) to avoid any potential ambiguity and bring it in line with rc behavior for such syntax.