Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate decimal no using ng-pattern in angularJs?

I want to validate decimal no like 0.5,0.05 and also natural no.

For natural no I used this pattern /^[0-9]{1,7}$/.

What pattern I will use for decimal no and natural no together?

like image 620
Mahendra Avatar asked Dec 01 '25 20:12

Mahendra


1 Answers

I think this should work. /^[0-9]{1,7}(\.[0-9]+)?$/

like image 81
Mobin Skariya Avatar answered Dec 03 '25 15:12

Mobin Skariya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!