Regex recipe: Check if string contains only digits
4 June 2023 (Updated 4 June 2023)
/^\d+$/.test('123') // true
/^\d+$/.test('123a') // false
Tagged:
Regex
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment