0

Currently, i'm using this reg exp:

!/[0-9]/

But for digits like '0.40', or '2.43' this doesn't work. How can I change that reg exp above to match floats as well?

1 Answer 1

1

please try this:

/(\-?\d*\.?\d+)/
  • '-?' - optional negative sign
  • '\d*' - 0 or more digits
  • '.?' - optional dot
  • '\d+' - one or more digits
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.