Function: safeRegex()
safeRegex(
pattern,flags?):RegExp|null
Defined in: packages/core/src/domain/services/safe-regex.ts:30
Attempts to compile a user-supplied pattern string into a RegExp.
Returns null when the pattern is syntactically invalid or when the
pattern contains nested quantifiers that could cause catastrophic
backtracking (ReDoS).
Parameters
pattern
string
The regular expression source string
flags?
string
Optional RegExp flags (e.g. 'i', 'm', 'g')
Returns
RegExp | null
The compiled RegExp, or null if the pattern is invalid or unsafe