Skip to content

Commit

Permalink
docs: mention the behavior of scan using regex with capturing groups
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Jan 27, 2025
1 parent da28628 commit 0a6639f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
7 changes: 6 additions & 1 deletion docs/content/manual/dev/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2699,12 +2699,17 @@ sections:
that match the regex in accordance with the flags, if any
have been specified. If there is no match, the stream is empty.
To capture all the matches for each input string, use the idiom
`[ expr ]`, e.g. `[ scan(regex) ]`.
`[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing
groups, the filter emits a stream of arrays, each of which contains
the captured strings.
examples:
- program: 'scan("c")'
input: '"abcdefabc"'
output: ['"c"', '"c"']
- program: 'scan("(a+)(b+)")'
input: '"abaabbaaabbb"'
output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]']

- title: "`split(regex; flags)`"
body: |
Expand Down
7 changes: 6 additions & 1 deletion docs/content/manual/v1.7/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2646,12 +2646,17 @@ sections:
that match the regex in accordance with the flags, if any
have been specified. If there is no match, the stream is empty.
To capture all the matches for each input string, use the idiom
`[ expr ]`, e.g. `[ scan(regex) ]`.
`[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing
groups, the filter emits a stream of arrays, each of which contains
the captured strings.
examples:
- program: 'scan("c")'
input: '"abcdefabc"'
output: ['"c"', '"c"']
- program: 'scan("(a+)(b+)")'
input: '"abaabbaaabbb"'
output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]']

- title: "`split(regex; flags)`"
body: |
Expand Down
6 changes: 5 additions & 1 deletion jq.1.prebuilt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/manonig.test

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0a6639f

Please sign in to comment.