Current section

Files

Jump to
gleam_stdlib gen src gleam@regex.erl
Raw

gen/src/gleam@regex.erl

-module(gleam@regex).
-compile(no_auto_import).
-export([compile/2, from_string/1, check/2, split/2, scan/2]).
-export_type([regex/0, match/0, compile_error/0, options/0]).
-type regex() :: any().
-type match() :: {match,
binary(),
integer(),
list(gleam@option:option(binary()))}.
-type compile_error() :: {compile_error, binary(), integer()}.
-type options() :: {options, boolean(), boolean()}.
-spec compile(binary(), options()) -> {ok, regex()} | {error, compile_error()}.
compile(A, B) ->
gleam_stdlib:compile_regex(A, B).
-spec from_string(binary()) -> {ok, regex()} | {error, compile_error()}.
from_string(Pattern) ->
gleam_stdlib:compile_regex(Pattern, {options, false, false}).
-spec check(regex(), binary()) -> boolean().
check(A, B) ->
gleam_stdlib:regex_match(A, B).
-spec split(regex(), binary()) -> list(binary()).
split(A, B) ->
gleam_stdlib:regex_split(A, B).
-spec scan(regex(), binary()) -> list(match()).
scan(A, B) ->
gleam_stdlib:regex_scan(A, B).