javascript - Regex to check whether a string contains only numbers

preview_player
Показать описание
#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?
Рекомендации по теме