compileRegex
compileRegex(
source,limits?):CompiledRegex
Defined in: packages/format-regex/src/regex.ts:27
Parses and compiles source — the Lexer → AST → Codec pipeline end to end.
Parameters
Section titled “Parameters”source
Section titled “source”string
limits?
Section titled “limits?”Returns
Section titled “Returns”Example
Section titled “Example” const re = compileRegex("(\\d+)-(\\d+)"); re.exec("pages 10-20"); // { index: 6, length: 5, text: "10-20", groups: [...] } ```;
## Throws
If the compiled program outgrows [RegexLimits.maxProgramSize](../type-aliases/RegexLimits.md#maxprogramsize). The returned matcher throws the same error if a run outgrows [RegexLimits.maxSteps](../type-aliases/RegexLimits.md#maxsteps).