|
5 | 5 | decode_float/1, decode_list/1, decode_option/2, decode_field/2, parse_int/1, |
6 | 6 | parse_float/1, less_than/2, string_pop_grapheme/1, string_pop_codeunit/1, |
7 | 7 | string_starts_with/2, wrap_list/1, string_ends_with/2, string_pad/4, |
8 | | - decode_map/1, uri_parse/1, |
9 | | - decode_result/1, bit_array_slice/3, decode_bit_array/1, compile_regex/2, |
10 | | - regex_scan/2, percent_encode/1, percent_decode/1, regex_check/2, |
11 | | - regex_split/2, base_decode64/1, parse_query/1, bit_array_concat/1, |
12 | | - bit_array_base64_encode/2, size_of_tuple/1, decode_tuple/1, decode_tuple2/1, |
13 | | - decode_tuple3/1, decode_tuple4/1, decode_tuple5/1, decode_tuple6/1, |
14 | | - tuple_get/2, classify_dynamic/1, print/1, println/1, print_error/1, |
15 | | - println_error/1, inspect/1, float_to_string/1, int_from_base_string/2, |
| 8 | + decode_map/1, uri_parse/1, decode_result/1, bit_array_slice/3, |
| 9 | + decode_bit_array/1, percent_encode/1, percent_decode/1, base_decode64/1, |
| 10 | + parse_query/1, bit_array_concat/1, bit_array_base64_encode/2, |
| 11 | + size_of_tuple/1, decode_tuple/1, decode_tuple2/1, decode_tuple3/1, |
| 12 | + decode_tuple4/1, decode_tuple5/1, decode_tuple6/1, tuple_get/2, |
| 13 | + classify_dynamic/1, print/1, println/1, print_error/1, println_error/1, |
| 14 | + inspect/1, float_to_string/1, int_from_base_string/2, |
16 | 15 | utf_codepoint_list_to_string/1, contains_string/2, crop_string/2, |
17 | | - base16_encode/1, base16_decode/1, string_replace/3, regex_replace/3, |
18 | | - slice/3, bit_array_to_int_and_size/1, bit_array_pad_to_bytes/1 |
| 16 | + base16_encode/1, base16_decode/1, string_replace/3, slice/3, |
| 17 | + bit_array_to_int_and_size/1, bit_array_pad_to_bytes/1 |
19 | 18 | ]). |
20 | 19 |
|
21 | 20 | %% Taken from OTP's uri_string module |
@@ -232,48 +231,6 @@ bit_array_slice(Bin, Pos, Len) -> |
232 | 231 | catch error:badarg -> {error, nil} |
233 | 232 | end. |
234 | 233 |
|
235 | | -compile_regex(String, Options) -> |
236 | | - {options, Caseless, Multiline} = Options, |
237 | | - OptionsList = [ |
238 | | - unicode, |
239 | | - ucp, |
240 | | - Caseless andalso caseless, |
241 | | - Multiline andalso multiline |
242 | | - ], |
243 | | - FilteredOptions = [Option || Option <- OptionsList, Option /= false], |
244 | | - case re:compile(String, FilteredOptions) of |
245 | | - {ok, MP} -> {ok, MP}; |
246 | | - {error, {Str, Pos}} -> |
247 | | - {error, {compile_error, unicode:characters_to_binary(Str), Pos}} |
248 | | - end. |
249 | | - |
250 | | -regex_check(Regex, String) -> |
251 | | - re:run(String, Regex) /= nomatch. |
252 | | - |
253 | | -regex_split(Regex, String) -> |
254 | | - re:split(String, Regex). |
255 | | - |
256 | | -regex_submatches(_, {-1, 0}) -> none; |
257 | | -regex_submatches(String, {Start, Length}) -> |
258 | | - BinarySlice = binary:part(String, {Start, Length}), |
259 | | - case string:is_empty(binary_to_list(BinarySlice)) of |
260 | | - true -> none; |
261 | | - false -> {some, BinarySlice} |
262 | | - end. |
263 | | - |
264 | | -regex_matches(String, [{Start, Length} | Submatches]) -> |
265 | | - Submatches1 = lists:map(fun(X) -> regex_submatches(String, X) end, Submatches), |
266 | | - {match, binary:part(String, Start, Length), Submatches1}. |
267 | | - |
268 | | -regex_scan(Regex, String) -> |
269 | | - case re:run(String, Regex, [global]) of |
270 | | - {match, Captured} -> lists:map(fun(X) -> regex_matches(String, X) end, Captured); |
271 | | - nomatch -> [] |
272 | | - end. |
273 | | - |
274 | | -regex_replace(Regex, Subject, Replacement) -> |
275 | | - re:replace(Subject, Regex, Replacement, [global, {return, binary}]). |
276 | | - |
277 | 234 | base_decode64(S) -> |
278 | 235 | try {ok, base64:decode(S)} |
279 | 236 | catch error:_ -> {error, nil} |
|
0 commit comments