I'm wondering if there is an easy way to set this validation on a form text field, without creating a custom directive.
I need to validate that {minlength: 2, maxlength: 10}
, user can enter any combination of [A-Z0-9\s]
, but only the amount of A-Z0-9
will go toward the minimum and maximum count.
Is this possible?
I was thinking maybe using ng-pattern and some magical regex might be able to pull this off. Just need a single error message to trigger if ng-pattern fails the match.