Skip to content

oneOf

Combine multiple regexes into one alternation, handling flags.

Import:

import { oneOf } from '@mnaoumov/typescript-lib/reg-exp';

Signature:

function oneOf(regExps: RegExp[], strategy: RegExpMergeFlagsConflictStrategy): RegExp

Parameters:

Parameter Type Description
regExps RegExp[] The regexes to combine.
strategy RegExpMergeFlagsConflictStrategy The strategy to use when merging flags (default: RegExpMergeFlagsConflictStrategy.Throw).

Returns: RegExp — The combined regex.