← Back to challenges

Distinct Digit in a Number

JavaScriptHardregexstringsvalidation

Instructions

Write a regular expression that matches numbers whose digits are not repeated (i.e. digits are distinct).

Examples

regularExpression.test("123") ➞ true

regularExpression.test("112233") ➞ false

regularExpression.test("1025") ➞ true

Notes

Input is a number as a string.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.