Skip to content

Function: Regex()

ts
function 
Regex
(
pattern
,
description
?):
TypeFunction
<string>;

Defined in: packages/parser/src/flag-types.ts:65

Creates a regex type function that validates the input against the provided pattern.

Parameters

ParameterTypeDescription
patternRegExpThe regular expression pattern to validate against
description?stringOptional description for display purposes

Returns

TypeFunction<string>

A TypeFunction that validates the input value

Throws

If the value does not match the regex pattern

在 MIT 许可证下发布