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

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -