Skip to content

oneOf

Combine multiple regexes into one alternation, handling flags.

Import:

import { oneOf } from 'obsidian-dev-utils/reg-exp';

Signature:

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

Parameters:

ParameterTypeDescription
regExpsRegExp[]The regexes to combine.
strategyRegExpMergeFlagsConflictStrategyThe strategy to use when merging flags (default: RegExpMergeFlagsConflictStrategy.Throw).

Returns: RegExp — The combined regex.