Regular expression for negative and positive decimal value so that can be matched with string using pattern and matcher for the correct implementation can any one will provide me with that
(\+|-)?([0-9]+(\.[0-9]+))
Try This! I've also used this way
"^-?[0-9]{1,12}(?:\.[0-9]{1,4})?$"
Rules:
ex: ^-?[0-9]{1,12}(?:\.[0-9]{1,4})?$
^ # Start of string
[0-9]{1,12} # Match 1-12 digits (i. e. 0-999999999999)
(?: # Try to match...
\. # a decimal point
[0-9]{1,4} # followed by one to three digits (i. e. 0-9999)
)? # ...optionally
$ # End of string
Try this:
[+-]?\d+\.\d+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With