Files
jq/tests
Nathan Chandrasekar 19752f50a9 Fix capture and sub with duplicate group names (#3676)
When a regex had several groups with the same name, a later group that
did not take part in the match overwrote an earlier one that did, so
capture returned null and sub interpolated null instead of the matched
text.

Build the capture object in capture/2 and in the sub reducer by adding
a one-key object for each named group, keeping the value already stored
for that name when the current group did not match. The last group of
each name that took part in the match now wins, empty-string matches
are kept, and the value stays null only when no group of that name
matched. Key order is unchanged. Add a regression test for capture, sub
and gsub.
2026-12-06 09:23:51 +09:00
..
…
…
…
…
…
…
…