← Back to challenges

Regex Series: String Contains at Least One Digit

JavaScriptHardstringsregexvalidation

Instructions

Write a regular expression that matches a string if it contains at least one digit.

Examples

"c8" ➞ true

"23cc4" ➞ true

"abwekz" ➞ false

"sdfkxi" ➞ false

Notes

This challenge is designed to use RegEx only.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: ES6: Destructuring Objects I