RosettaCodeData/Task/String-matching/Jq/string-matching-2.jq
2026-02-01 16:33:20 -08:00

11 lines
183 B
Text

# In jq 1.4 or later:
jq -n '"abcdabcd" | indices("bc")'
[
1,
5
]
# In jq 1.5, the regex function match/1 can also be used:
$ jq -n '"abcdabcd" | match("bc"; "g") | .offset'
1
5