RegexPattern
A validated regular expression: it cannot exist unless it compiles. `fromRaw` is the only way to build one, so an uncompilable pattern is rejected at construction (a schema error), never at match time. `matches` distinguishes a genuine non-match from an engine failure (backtrack/recursion limit) — the latter is a RegexExecutionException, never a user-facing pattern_mismatch.
RegexPattern::fromRaw()
public static function fromRaw(string $pattern): selfBuilds a RegexPattern from a raw string, throwing InvalidSchemaException if it does not compile.
Parameters
| Name | Type | Description |
|---|---|---|
| $pattern | string |
RegexPattern::matches()
public function matches(string $value): boolTests whether the value matches, throwing RegexExecutionException on an engine failure.
Parameters
| Name | Type | Description |
|---|---|---|
| $value | string |