docs: mention the behavior of scan using regex with capturing groups (#3240)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by itchyny · committed by GitHub · parent 39eea14 · Browse files · 4 files·+23 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+23 added−3 removed
- tests:+6 added−0 removed
- other:+17 added−3 removed
Provenance
- Commit
ce54621- Tree
4fd4fee- Author
itchyny <itchyny@cybozu.co.jp>- Committer
GitHub <noreply@github.com>- Parent
39eea14
4 files changed+23 added−3 removed
modified:docs/content/manual/dev/manual.yml+6 added-1 removed
2697 unmodified lines2698 Emit a stream of the non-overlapping substrings of the input2699 that match the regex in accordance with the flags, if any2700 have been specified. If there is no match, the stream is empty.2701 To capture all the matches for each input string, use the idiom2702- `[ expr ]`, e.g. `[ scan(regex) ]`.2702+ `[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing2703+ groups, the filter emits a stream of arrays, each of which contains2704+ the captured strings.2705 2706 examples:2707 - program: 'scan("c")'2708 input: '"abcdefabc"'2709 output: ['"c"', '"c"']2710+ - program: 'scan("(a+)(b+)")'2711+ input: '"abaabbaaabbb"'2712+ output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]']2713 2714 - title: "`split(regex; flags)`"2715 body: |2716 1115 unmodified linesmodified:docs/content/manual/v1.7/manual.yml+6 added-1 removed
2644 unmodified lines2645 Emit a stream of the non-overlapping substrings of the input2646 that match the regex in accordance with the flags, if any2647 have been specified. If there is no match, the stream is empty.2648 To capture all the matches for each input string, use the idiom2649- `[ expr ]`, e.g. `[ scan(regex) ]`.2649+ `[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing2650+ groups, the filter emits a stream of arrays, each of which contains2651+ the captured strings.2652 2653 examples:2654 - program: 'scan("c")'2655 input: '"abcdefabc"'2656 output: ['"c"', '"c"']2657+ - program: 'scan("(a+)(b+)")'2658+ input: '"abaabbaaabbb"'2659+ output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]']2660 2661 - title: "`split(regex; flags)`"2662 body: |2663 1039 unmodified linesmodified:tests/manonig.test+6 added
45 unmodified lines46 "abcdefabc"47 "c"48 "c"49 50+scan("(a+)(b+)")51+"abaabbaaabbb"52+["a","b"]53+["aa","bb"]54+["aaa","bbb"]55+56 split(", *"; null)57 "ab,cd, ef"58 ["ab","cd","ef"]59 23 unmodified linesmodified:jq.1.prebuilt+5 added-1 removed
2983 unmodified lines2984 .2985 .IP "" 02986 .2987 .SS "scan(regex), scan(regex; flags)"2988-Emit a stream of the non\-overlapping substrings of the input 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 \fB[ expr ]\fR, e\.g\. \fB[ scan(regex) ]\fR\.2988+Emit a stream of the non\-overlapping substrings of the input 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 \fB[ expr ]\fR, e\.g\. \fB[ scan(regex) ]\fR\. If the regex contains capturing groups, the filter emits a stream of arrays, each of which contains the captured strings\.2989 .2990 .IP "" 42991 .2992 .nf2993 2994 jq \'scan("c")\'2995 "abcdefabc"2996 => "c", "c"2997+2998+jq \'scan("(a+)(b+)")\'2999+ "abaabbaaabbb"3000+=> ["a","b"], ["aa","bb"], ["aaa","bbb"]3001 .3002 .fi3003 .3004 .IP "" 01267 unmodified lines