Function: validatePattern()
validatePattern(
value:string,pattern:RegExp,fieldName:string,patternDescription:string): {error?:string;isValid:boolean; }
Defined in: shared/utils/formValidation.ts:237
Validates that a field matches a specific pattern (regex).
Parametersโ
valueโ
string
The value to validate
patternโ
The regex pattern to match against
fieldNameโ
string = "Field"
Optional field name for error messages
patternDescriptionโ
string = "the required format"
Human-readable description of the pattern
Returnsโ
{ error?: string; isValid: boolean; }
Validation result with success status and optional error message
error?โ
optionalerror:string
isValidโ
isValid:
boolean
Remarksโ
Generic pattern validation utility for custom validation rules.