`indices` behaves differently when dealing with arrays vs strings
kklingenberg opened this issue · comments
Kai Klingenberg commented
Describe the bug
Not sure if it is a bug. The behaviour of indices
differs when given arrays vs strings when the matches overlap.
To Reproduce
[0, 0, 0] | indices([0, 0]) == [0, 1]
vs.
"aaa" | indices("aa") == [0]
Expected behavior
Both cases should match, or if the difference is intented the string case should be documented.
Environment (please complete the following information):
- OS and Version: Ubuntu 22.04
- jq version 1.7
Additional context
Related issue in jaq: 01mf02/jaq#154
itchyny commented
Previously jq 1.6 worked like this but I think jq 1.7 works as expected (fixed by #2718).
Kai Klingenberg commented
You're right, I accidentally used the previous version of jq when running the example :(
Sorry.