4
Answers

Need Regex for allowing numbers along with

Chaitanya

Chaitanya

13y
2.3k
1
Hi all i would like to have a regex that should allow numeric values along with .

also i will have a maximum length for text box as 10 if i enter only numeric it should count if i enter dot it should not count as an input.

Also i wrote a javascript to convert the entered number to US format so my text box will always have its initial value as $.

Example :

If user enters 1234567890 as per my script it will convert as $1234,567,890.00 which works fine but user can enter some thing like 1.23 so that it will convert to $1.23 so i need a regex such that first character should be $ and dot is allowed in between the numbers and only numeric values should count as length

Answers (4)