← Back to challenges

Regex Series: Even Number?

PythonHardstringsregexvalidation

Instructions

Write a regular expression that matches only an even number. Numbers will be presented as strings.

Examples

"2341" ➞ false

"132" ➞ true

"29" ➞ false

"5578" ➞ true

Notes

This challenge is designed for RegEx only.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Is the Phone Number Formatted Correctly?