Monday, February 8, 2016

1. Javascript regular expression to support both decimal numbers and only integers.

/^[0-9]+(\.[05]{1})?$/

Above expression allows only integers and decimal numbers

1. it allows only 0 or 5 after decimal point
2.It allows only one digit after decimal point
4.some valid expresions are

1
1.0
1.5


No comments:

Post a Comment