javascript - Determine if a string is only numbers or a comma -
how can determine if string contains numbers or comma?
var x = '99,999,999'; var ismatch = x.match('/[\d|,]/'); the above returns null.
to little more exact:
/^\d{1,3}(?:,\d{3})*$/ only matches when number delimited comma after every 3rd digit right. (this doesn't account decimals)
Comments
Post a Comment