Skip to content
Myr

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

4 files+23 added−3 removed

modified:docs/content/manual/dev/manual.yml+6 added-1 removed
2697 unmodified lines
2698 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.27052706 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"]']27132714 - title: "`split(regex; flags)`"2715 body: |2716
1115 unmodified lines
modified:docs/content/manual/v1.7/manual.yml+6 added-1 removed
2644 unmodified lines
2645 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.26522653 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"]']26602661 - title: "`split(regex; flags)`"2662 body: |2663
1039 unmodified lines
modified:tests/manonig.test+6 added
45 unmodified lines
46"abcdefabc"47"c"48"c"4950scan("(a+)(b+)")51"abaabbaaabbb"52["a","b"]53["aa","bb"]54["aaa","bbb"]5556split(", *"; null)57"ab,cd, ef"58["ab","cd","ef"]59
23 unmodified lines
modified:jq.1.prebuilt+5 added-1 removed
2983 unmodified lines
2984.2985.IP "" 02986.2987.SS "scan(regex), scan(regex; flags)"2988Emit 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\.2988Emit 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.nf29932994jq \'scan("c")\'2995 "abcdefabc"2996=> "c", "c"29972998jq \'scan("(a+)(b+)")\'2999 "abaabbaaabbb"3000=> ["a","b"], ["aa","bb"], ["aaa","bbb"]3001.3002.fi3003.3004.IP "" 0
1267 unmodified lines