Unicode.Set.compile_pattern

You're seeing just the function compile_pattern, go back to Unicode.Set module for more information.
Link to this function

compile_pattern(unicode_set)

View Source

Specs

compile_pattern(binary()) :: {:ok, [binary()]} | {:error, {module(), binary()}}

Transforms a Unicode Set into a compiled pattern that can be used with String.split/3 and String.replace/3.

Compiled patterns can be the more performant when matching strings.

Arguments

  • unicode_set is a string representation of a Unicode Set

Returns

  • {:ok, compiled_pattern} or

  • {:error, {exception, reason}}

Example

    iex> pattern = Unicode.Set.compile_pattern "[[:digit:]]"
    {:ok, {:ac, #Reference<0.2927979228.2367029250.255911>}}
    iex> String.split("abc1def2ghi3jkl", pattern)
    ["abc", "def", "ghi", "jkl"]