0

I need a validate a textbox for numbers only alongwith a few special conditions. The allowed values are:

  1. decimal numbers >= 0 [E.g. 25]
  2. floating point numbers [E.g. 25.83]
  3. decimal numbers with comma [E.g. 1,800]

I tried this regex method. but it is obviously not the correct regex for all the conditions. Please help in getting this fixed.

function validateText(text) { 
        var regex = new RegExp('^[0-9]+$');
        return regex.test(text);
    } 
Riju Mahna
  • 6,718
  • 12
  • 52
  • 91

0 Answers0