Unicode.Set.to_pattern

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

Specs

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

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

Arguments

  • unicode_set is a string representation of a Unicode Set

Returns

  • {:ok, pattern} or

  • {:error, {exception, reason}}

Example

    iex> pattern = Unicode.Set.to_pattern "[[:digit:]]"
    {:ok,
     ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "٠", "١", "٢", "٣",
      "٤", "٥", "٦", "٧", "٨", "٩", "۰", "۱", "۲", "۳", "۴", "۵", "۶",
      "۷", "۸", "۹", "߀", "߁", "߂", "߃", "߄", "߅", "߆", "߇", "߈", "߉",
      "०", "१", "२", "३", "४", "५", "६", "७", ...]}