How do I store a Regex Validator pattern for reuse and Dry principal in Angular? Have a reactive formbuilder with Regex validator pattern below for ZipCode.
Need to apply to multiple address forms, curious how to save /^\d{1,5}$/
So we can write Validators.pattern(zipcode)
, or any syntax utilized in Angular?
Company has more complicated long patterns for phone numbers, customer number, etc.
'ZipCode': [null, [Validators.maxLength(16), Validators.pattern(/^\d{1,5}$/)]],
Looking for a way to store and utilize maybe in constants.
This is for Angular 2: