|
32 | 32 | encode_hex/1, encode_hex/2, |
33 | 33 | part/3, |
34 | 34 | split/2, split/3, |
| 35 | + match/2, match/3, |
35 | 36 | replace/3, replace/4 |
36 | 37 | ]). |
37 | 38 |
|
@@ -103,6 +104,33 @@ encode_hex(Data, uppercase) -> |
103 | 104 | encode_hex(Data, lowercase) -> |
104 | 105 | <<<<(hd(string:to_lower(integer_to_list(B, 16)))):8>> || <<B:4>> <= Data>>. |
105 | 106 |
|
| 107 | +%%----------------------------------------------------------------------------- |
| 108 | +%% @equiv match(Binary, Pattern, []) |
| 109 | +%% @param Binary binary to search in |
| 110 | +%% @param Pattern pattern to search for |
| 111 | +%% @returns `{Start, Length}' or `nomatch' |
| 112 | +%% @doc Find the first occurrence of Pattern in Binary. |
| 113 | +%% @end |
| 114 | +%%----------------------------------------------------------------------------- |
| 115 | +-spec match(Binary :: binary(), Pattern :: binary() | [binary()]) -> |
| 116 | + {non_neg_integer(), non_neg_integer()} | nomatch. |
| 117 | +match(_Binary, _Pattern) -> |
| 118 | + erlang:nif_error(undefined). |
| 119 | + |
| 120 | +%%----------------------------------------------------------------------------- |
| 121 | +%% @param Binary binary to search in |
| 122 | +%% @param Pattern pattern to search for |
| 123 | +%% @param Options options for the match |
| 124 | +%% @returns `{Start, Length}' or `nomatch' |
| 125 | +%% @doc Find the first occurrence of Pattern in Binary. |
| 126 | +%% Options can include `{scope, {Start, Length}}'. |
| 127 | +%% @end |
| 128 | +%%----------------------------------------------------------------------------- |
| 129 | +-spec match(Binary :: binary(), Pattern :: binary() | [binary()], Options :: [term()]) -> |
| 130 | + {non_neg_integer(), non_neg_integer()} | nomatch. |
| 131 | +match(_Binary, _Pattern, _Options) -> |
| 132 | + erlang:nif_error(undefined). |
| 133 | + |
106 | 134 | %%----------------------------------------------------------------------------- |
107 | 135 | %% @param Binary binary to extract a subbinary from |
108 | 136 | %% @param Pos 0-based index of the subbinary to extract |
|
0 commit comments