aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.erl
diff options
context:
space:
mode:
authorErik Terpstra <erterpstra@gmail.com>2020-06-25 11:20:25 +0200
committerLouis Pilfold <louis@lpil.uk>2020-06-25 14:31:57 +0100
commit8de363f9d7ddd3df55df73b27a3a87cf7c9bd707 (patch)
treead2f3fbe34697ffe542573b552038bff2bae5bca /src/gleam_stdlib.erl
parent641c5050ed226ef9fc1dbbe35df579dcd2e504d3 (diff)
downloadgleam_stdlib-8de363f9d7ddd3df55df73b27a3a87cf7c9bd707.tar.gz
gleam_stdlib-8de363f9d7ddd3df55df73b27a3a87cf7c9bd707.zip
Remove Match.number
Diffstat (limited to 'src/gleam_stdlib.erl')
-rw-r--r--src/gleam_stdlib.erl10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/gleam_stdlib.erl b/src/gleam_stdlib.erl
index 217d4d1..85855d1 100644
--- a/src/gleam_stdlib.erl
+++ b/src/gleam_stdlib.erl
@@ -200,17 +200,13 @@ regex_submatches(String, {S, L}) ->
false -> {some, SubMatch}
end.
-regex_matches(String, [{S, L} | Submatches], Number) ->
- {match, binary:part(String, S, L), S, Number,
+regex_matches(String, [{S, L} | Submatches]) ->
+ {match, binary:part(String, S, L), S,
lists:map(fun(X) -> regex_submatches(String, X) end, Submatches)}.
-regex_captured(_, [], _) -> [];
-regex_captured(String, [ H | T ], Number) ->
- [ regex_matches(String, H, Number) | regex_captured(String, T, Number + 1) ].
-
regex_scan(Regex, String) ->
case re:run(String, Regex, [global]) of
- {match, Captured} -> regex_captured(String, Captured, 1);
+ {match, Captured} -> lists:map(fun(X) -> regex_matches(String, X) end, Captured);
_ -> []
end.