Angular: Write an Exclude List Character Validator for Formbuilder

I am want to write an Angular FormBuilder validator that excludes a certain list of characters: @##$%^&*()[email protected]#

Want to write it as exclusion list validator, so we can add maybe Certain Letters or other text in future.

Validators.pattern(

Resources:

This answer writes it as an Include List instead of Exclude List

/^[a-zA-Z0-9]*$/

write an ng-pattern to disallow whitespaces and special characters

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.