ts-regex-builder
Version:
Maintainable regular expressions for TypeScript and JavaScript.
21 lines (20 loc) • 671 B
TypeScript
import type { EncodedRegex, RegexSequence } from '../types';
/**
* Options for the `repeat` function.
*
* @param min - Minimum number of times to match.
* @param max - Maximum number of times to match (default: unlimited).
* @param greedy - Whether to use greedy quantifiers (default: true).
*/
export type RepeatOptions = number | {
min: number;
max?: number;
greedy?: boolean;
};
/**
* Creates a quantifier which matches the given sequence a specific number of times.
*
* @param sequence - Sequence to match.
* @param options - Quantifier options.
*/
export declare function repeat(sequence: RegexSequence, options: RepeatOptions): EncodedRegex;