Float Regex format for a 2 decimal place number between 0 and 100 [duplicate]

I need to validate a float number with 2 decimal place digits.the number should be between 0 - 100. (99.99 inclusive) But don't know how to do it. Please guide me through it. Javascript/jQuery both are fine. thanks.



If you want to match a number between 0 - 100 and contains also two decimals, you can use a regex like this:


Working demo

enter image description here


^\d{1,2}(\.\d{,2})?$, assuming you're guaranteed that this is the only thing going into your input box.


The regex to validate a number between 0 - 100 (exclusive of 100) with two decimal digits is



console.log( /^[1-9]?\d\.\d\d$/.test('0.10') );    // true

If the decimal digits are optional (i.e. there may be 0, 1, or 2 decimal digits) instead use



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.