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
0
votes
1 answer

Allow a range of numbers, and still exclude a specific number(s)

I have a DHCP Scope input It works perfectly for DHCP scope range from 1-254, but I also want to exclude the number 111. How do…
code-8
  • 54,650
  • 106
  • 352
  • 604
0
votes
1 answer

angulajs ng-pattern validator for input field

I am working with angularjs form validations, where i have few fields need to validate them, i will only allow the user to enter input starting with certain mix of characters and numbers(will be 7 after characters)like BID0001234, Q0001234 and…
Praveen
  • 347
  • 1
  • 3
  • 20
0
votes
3 answers

How to allow only 3 digit and one dot in Regular Expression

I want to do like this : 3.40 and not more than 3 characters and one dot:
0
votes
1 answer

Dynamically Set ng-pattern base on user inputs

I have input box I already 2 patterns for IPv4 and IPv6 ready. $scope.ip_regex =…
code-8
  • 54,650
  • 106
  • 352
  • 604
0
votes
2 answers

How to validate specific email address using ng-pattern?

I have email validation that has specific format ab123c@email.com or ab1234@email.com its validationg first 5 characters but not the complete email address using angularjs ng-pattern. How can i validate specific email address using angularjs…
hussain
  • 6,587
  • 18
  • 79
  • 152
0
votes
1 answer

Angular can I have 2 ng-pattern to validate the same filed

My current input looks like this My ng-pattern="ctrl.emailRegex" validates if an email is valid or…
Ugo Guazelli
  • 703
  • 3
  • 8
  • 19
0
votes
2 answers

AngularJS 1.x: How to show custom message in ng-pattern?

I am creating a form and trying to put in following password validation: Minimum 8, at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character: Using the following…
akshay
  • 61
  • 6
0
votes
0 answers

issue with angularjs ng-pattern special character & (ampersand)

issue with angularjs ng-pattern special character & (ampersand) angularjs ng-pattern="/^[-& A-Za-z'0-9#/]*$/". Input text filed should be able to take the special character &, but it is not. Input filed is being reported as invalid. Any reason…
helloworld
  • 31
  • 4
0
votes
0 answers

Conditional ng-pattern angularjs 1.2

I would like to apply an ng-pattern validation on my input
Hakim
  • 1,084
  • 11
  • 28
0
votes
0 answers

ng-pattern becomes invalid when ng-required value changes

I have the following html:
Rotem B
  • 1,327
  • 1
  • 15
  • 20
0
votes
1 answer

ng-pattern regex throwing error

I am using ng-pattern to validate number(Comma seperated input field allowing only number). But it is throwing the following error in the console eventhough it is working fine. Can anyone tell me what I am doing wrong. ERROR: SyntaxError: Invalid…
Anusha Sajeendran
  • 181
  • 1
  • 3
  • 17
0
votes
1 answer

how to use two regex variable into single ng-pattern directive?

I am trying to pass two regex variable regex1 and regex2 for email and mobile number into single ng-pattern by using "OR" condition but it is not working. if i pass a single variable at a time then it works perfectly. So what i have to do to pass…
Sunny
  • 577
  • 6
  • 20
0
votes
3 answers

ng-class not setting class right after conditions are met

I have an issue where I validate one field using ng-pattern and try to change the look of input using ng-class. The problem occurs when pattern is not met, since at the beginning there is no reaction. My pattern requires that there is at least two…
MrHutnik
  • 118
  • 3
  • 9
0
votes
2 answers

how to specify a decimal (dd,dd) with type text usign ng-pattern

I hope my question is clear, what i want to do is validating a decimal with 2 numbers max in the entry part and 2 numbers max in the decimal part (example 99,99) and i want it to accept 100 as max. I can't use type="number" with min and max because…
Smahane
  • 175
  • 1
  • 5
  • 13
0
votes
1 answer

AngularJS ng-pattern [$parse:lexerr] Lexer Error: Unexpected next character

I have a little problem with my regex in AngularJS my regex in the html looks like this: ng-pattern="[adfijmPrsyz\d]+" but i get an error in the console which says: angular.js:13920 Error: [$parse:lexerr] Lexer Error: Unexpected next character at…
Andrew
  • 235
  • 5
  • 11