Spark.Regex (spark v2.2.66)

View Source

Utilities for caching compiled regular expressions.

This module provides a way to cache compiled regular expressions in persistent_term to work around OTP 28's restriction on compile-time regex creation.

Summary

Functions

Retrieves a cached regex or compiles and caches it if not found.

Functions

cache(source, opts)

Retrieves a cached regex or compiles and caches it if not found.

Parameters

  • source - The regex source string
  • opts - The regex compilation options (e.g., "ims", "u", etc.)

Returns

The compiled Regex struct.

Examples

iex> Spark.Regex.cache("foo.*bar", "i")
~r/foo.*bar/i