Questions tagged [ng-pattern]

HTML input element control with angular data-binding. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.

HTML input element control with angular data-binding. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.

Source: http://docs.angularjs.org/api/ng/directive/input

170 questions
61
votes
12 answers

How to validate email id in angularJs using ng-pattern

Am trying to validate an Email id field in angularJs using ng-pattern directive. But am new to AngularJs. I need to show an error message as soon as the user enters the wrong email id. The code which I have below is am trying to solve. Help me out…
anon
12
votes
4 answers

How to add password validation using regular expression in angularjs according to certain criterion?

I want to validate password entered by user for following criteria : Password should be at least 8 characters long and should contain one number,one character and one special character. For it I used following regular expression…
9
votes
2 answers

Conditional ng-pattern in angular js

Is there a way to achieve conditional ng-pattern in angularjs ng-pattern="(myForm.exipration.$dirty ? ('/^\d{2}[/]\d{4}$/') : '')" i tried like above, but does not help.
Hacker
  • 7,798
  • 19
  • 84
  • 154
6
votes
1 answer

angularJS ng-pattern not working

Please take a look plunker. http://plnkr.co/edit/DuTFYbLVbPkCIvRznYjG?p=preview where ng-pattern regEx is not going to apply on input text field. where only required validation is applying properly. HTML: …
user3249448
  • 1,369
  • 2
  • 14
  • 34
5
votes
3 answers

ng-pattern allow only letters, numbers, dot, underscore and dash

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\-\_]+$/';
el.severo
  • 2,202
  • 6
  • 31
  • 62
5
votes
3 answers

ng-pattern with regex having double quotes does not escape correctly

I have a ng-pattern validation for a regex of ^[^\./:*\?\"<>\|]{1}[^\/:*\?\"<>\|]{0,254}$ which basically tests the invalid chars in filepath and teh limit. but when i have the ng-pattern specified as ng-pattern =…
looneytunes
  • 741
  • 4
  • 16
  • 35
5
votes
2 answers

How to get use ng-pattern

I have a simple text input in which I only want to allow floats and ints (watch out: jade) input.form-control(type="text", ng-model='usd', ng-pattern="nums",ng-change='convert_to_btc()', placeholder="USD") However it doesn't work, I can always…
transient_loop
  • 5,984
  • 15
  • 58
  • 117
5
votes
2 answers

Angularjs ui-mask with ng-pattern

below code is not working..
user3056462
  • 75
  • 2
  • 6
4
votes
3 answers

AngularJS : email or phone number validation

Expectation : I am working on login form in Angular. Users can login with Email/Phone. I need to validate the Email/Phone in single text-box. Live Scenario : Facebook implemented same type of functionality in login. we can login in Facebook via…
Debug Diva
  • 26,058
  • 13
  • 70
  • 123
4
votes
2 answers

Angularjs regular expression

In my Angularjs application I need to have regular expression for two patterns for form validation with the following condition. Pattern 1 : The input box should accept alphanumeric with no space and it should also allow the user to use the…
Madasu K
  • 1,813
  • 2
  • 38
  • 72
4
votes
3 answers

Using ng-pattern to validate email in AngularJS

I'm new to Angular and have trouble getting the ng-pattern to validate the email address based on a REGEX. In fact the other default angular validation for email also changes behaviour and only shows an error if the entire field is empty when I…
Afshin Ghazi
  • 2,784
  • 4
  • 23
  • 37
3
votes
1 answer

ng-pattern for alphanumeric and all special symbol characters

In input, I need to allow alphanumeric and all special symbol character. I am using the following pattern. Unfortunatelly, it is not working. ng-pattern="/^[ A-Za-z0-9_@./#$=!%^)(]:*;?/\,}{'|<>[&+-]*$/"
Nithin
  • 483
  • 5
  • 11
3
votes
1 answer

AngularJs ng-pattern regex

I am struggling writing a Regex for angular ng-pattern to validate a form input field.An example of the possible inputs are below Valid input: @tag1,@tag2,@tag3 @tag1, @tag2, @tag3 @tag1 Invalid Input: @tag 1 @tag 1, @tag2, @tag -3 @ta g1, @t…
Steven.lin
  • 103
  • 1
  • 1
  • 11
3
votes
2 answers

ng-pattern to validate password match

I use this to validate a password that has to have 8 characters, one capital letter and numeric but when I add an asterisk to it it throws an error saying passwords do not match, this only happens using the asterisk. Any help will be appreciate it…
Gilberto Quintero
  • 397
  • 1
  • 6
  • 18
3
votes
1 answer

Regex pattern for mobile number validation with extension

I have seperate regex validations for my requirement but struggling to combine them in one. I am validation mobile numbers with country code or starting with 00 and also if they contain extension number(2-5 digits) seperated by # Following is the…
Pratswinz
  • 1,476
  • 11
  • 24
1
2 3
11 12