filmov
tv
javascript - Regex to check whether a string contains only numbers
Показать описание
#short
#javascript
#regex
var reg = new RegExp('^[0-9]$');
I get false on both "123" and "123f". I would like to check if the hash only contains numbers. Did I miss something?
#javascript
#regex
var reg = new RegExp('^[0-9]$');
I get false on both "123" and "123f". I would like to check if the hash only contains numbers. Did I miss something?