Answer the question
In order to leave comments, you need to log in
How to write a regular expression for a number?
You need to write a regular expression for a positive number, with or without 2 decimal places. No other characters are allowed, zero cannot be the first character
Example:
12.13 = true
1.12 = true
234234 = true
0213 = false
-234.23 = false
0.12 = false
23-.23 = false
23f = false
Just this: \d+( \.\d{0,2})?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question