%% https://www.erlang.org/doc/apps/stdlib/re.html %% https://erikarow.land/notes/using-erlang-re %% https://zotonic.com/cookbook/1601/just-enough-regular-expressions-in-erlang %% Erlang supports regular expressions through its standard library "re" module, %% which, as of Erlang/OTP 28, uses the modern PCRE2 library). %% The "regexp" module is obsolete and should not be used. %% Match: re:run("The quick brown fox.", "ick"). re:run(<<"Слово по-русски!."/utf8>>, <<"усс"/utf8>>). %% Replace: re:replace("Hello world and universe!", "e", "E", [global]). re:replace(<<"Слово по-русски!."/utf8>>, <<"[Cc]лово"/utf8>>, <<"Фраза"/utf8>>). %% Split: re:split("apple,orange,grapefruit,mango,persimmon", ","). re:split(<<"рис№пшено№нут"/utf8>>, <<"№"/utf8>>). %% Options. %% Functions in re module often accept an optional list of options. %% {capture, all, list}: Returns captured parts as strings (or binaries), %% instead of {Offset, Length} tuples. %% global: Used with re:run or re:replace to find/replace all occurrences in the %% subject string, not just the first one. %% caseless: Makes the matching case-insensitive. %% Extra info: %% timer:sleep(5000), timer:seconds(5), timer:minutes(5), timer:hours(5).