How'd allow for an input using ng-pattern
only: letters
, numbers
, dot
, underscore
and dash
( . _ -)
?
Already tried the following ones
UPDATE:
$scope.validationPattern = '/^[a-zA-Z\d\-\_]+$/';
<input ng-model="model" type="text" ng-pattern="{{validationPattern}}" />
Judging by your requirements, you need to add a dot to the pattern:
$scope.regex = '^[a-zA-Z0-9._-]+$';
and add ng-trim="false"
to the <input>
tag so as to disallow leading/trailing spaces.
See this plunkr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With