# `Spark.Regex`
[🔗](https://github.com/ash-project/spark/blob/v2.7.3/lib/spark/regex.ex#L5)

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.

# `cache`

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
