Skip to content

Commit 35f03f8

Browse files
committed
main
1 parent 1f7a1d9 commit 35f03f8

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

docs/document/Bash/docs/Basics/1. Checkout Where.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/document/Bash/docs/Basics/2. Checkout File Information.md

Whitespace-only changes.

docs/document/Lua/docs/String.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ local start, tail, tag, content = text:find('<(%w+)>(%w+)</%w+>')
3333
- `pattern: string | number`: pattern to replace
3434
- `repl: string | number | function | table`
3535
- `string`: may use `%n` to reference capture groups by index `n` to transform from groups
36-
- `fun(match: string): string`: to replace the occurrence by tranformed string from the match(`match` parameter is just the first match)
36+
- `fun(...matches: string): string`: to replace the occurrence by tranformed string from the match
3737
- `table<string, string>`: a finite pairs for match(key) and replacement(value)
3838
- `n?: int`: max count of substitutions could be made
3939

@@ -63,6 +63,24 @@ local sub, count = text:gsub('%l+', {
6363
-- because the table were tried anyway and got nil when key is not registered
6464
```
6565

66+
#### Matches on Callback
67+
68+
One can access one or more captured groups in callback function of `string.gsub`
69+
70+
```lua
71+
local foo = 'abc efg'
72+
local p = '(%w+) (%w+)'
73+
74+
_, _ = foo:gsub(p, function(match1, match2) -- arbitrary count of matches
75+
print(match1) -- abc
76+
print(match2) -- efg
77+
return 'foo'
78+
end)
79+
```
80+
81+
> [!CAUTION]
82+
> Do not include `^` in any capture group, it stops matching.
83+
6684
### Get Captured Groups
6785

6886
#### Match for One time

docs/document/Modern CSharp/docs/Parallel Programming/Parallel Utils/Parallel Linq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ try {
112112

113113
Parallel iterations were scheduled as groups, so buffering is enabled by default and the size of group is dependent on the system.
114114

115-
- `ParallelMergeOptions.AutoBuffered`
115+
- `ParallelMergeOptions.AutoBuffered`: the default option, buffering made by internal design
116116
- `ParallelMergeOptions.Default`: alias to `AutoBuffered`
117117
- `ParallelMergeOptions.FullyBuffered`: source not available until all iteration were finished
118118
- `ParallelMergeOptions.NotBuffered`: yield item immediately whenever available

0 commit comments

Comments
 (0)