I am working towards developing an Angular Validator
that will prevent consecutive spaces from being entered.
At the moment, I have implemented
Validators.pattern('^[a-zA-Z0-9]+( [a-zA-Z0-9]+)*$')
, which successfully addressed the issue. However, it inadvertently restricts special characters, which is not desirable.
text text
should not be considered valid due to multiple consecutive spaces- The validator should also account for cases where spaces are at the beginning or end of the string
text α
should not trigger an error even thoughα
is a special character