execProgram
execProgram(
program,input,maxSteps?):RegexMatch|undefined
Defined in: packages/format-regex/src/vm/pike-vm.ts:179
Runs a RegexProgram against input, returning the leftmost match
(and, among threads starting at the same position, the one preferred by
greedy/lazy quantifier priority) or undefined if there is none.
This is a Pike VM: every thread advances one input character per step in
lockstep, so this is O(program size × input length) with no backtracking — a
pathological pattern like (a+)+b cannot exhibit catastrophic (ReDoS)
behavior here the way it can in a backtracking engine.
Parameters
Section titled “Parameters”program
Section titled “program”string
maxSteps?
Section titled “maxSteps?”number = DEFAULT_REGEX_LIMITS.maxSteps
Most thread activations this run may perform; see
RegexLimits.maxSteps, whose default this takes.
Returns
Section titled “Returns”RegexMatch | undefined
Throws
Section titled “Throws”If the run outgrows maxSteps. Linear is
not the same as bounded: the work is program size × input length, and a
caller holding neither factor needs a ceiling on the product.