/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ /** * Screen for the catastrophic-backtracking shapes this module models, without * throwing. * * A `false` is not a safety guarantee, only the absence of a modelled shape: * the screen is a heuristic, not a decision procedure. What is actually * ENFORCED is the match budget applied at match time — see * `createBoundedRegexMatcher`, which interrupts a running match after a fixed * wall-clock budget. Treat this as a fast, friendly rejection of obviously * dangerous input, never as the containment. */ export declare function hasUnsafeRegexShape(pattern: string): boolean; /** * Escapes every regex metacharacter, so caller text can be compiled into a * pattern that matches it literally rather than being read as one. The other * half of {@link assertSafeRegexPattern}: that guards text the caller *meant* * as a pattern, this guards text they did not. */ export declare function escapeRegExp(value: string): string; /** * Rejects regex sources prone to catastrophic backtracking (ReDoS) before they * ever reach `new RegExp`. Throws {@link TaskInvalidInputError} for a pattern * with too many `[` characters, with nested quantifiers like `(a+)+`, or with a * quantified alternation whose branches overlap like `(a|a)*`. * * This is a screen, not the containment — see {@link hasUnsafeRegexShape}. */ export declare function assertSafeRegexPattern(pattern: string): void; /** Screens a pattern, then compiles it. */ export declare function compileSafeRegex(pattern: string, flags: string): RegExp;