javascript - AngularJS ng-pattern regular expression -


i have following input field accepts price value.

input{      type="text"      name="price"      np-currency=true     ng-model='price'     ng-pattern="/[$,.]\d*$/" } 

this pattern("/[$,.]\d*$/") makes input field invalid $25.34@@@c%34 correct 25 becomes invalid thats because not have either $ or , or. how make optional?

i need $25.00 or 25 valid not $25.00$%#$%%@@.

requirement: digits $, , . valid

i appreciate suggestions on regular expression.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -