Regular Expressions 101

Community Patterns

Community Library Entry

-2

Regular Expression
PCRE (PHP <7.3)

/
^([1-9])(?!\1)([0-9])(?!\1|\2)([0-9])(?!\1|\2|\3)([0-9])$
/
gm

Description

A pcre that capture a 4-digit numeric that does not allow a leading zero and no repeat digits.

Submitted by Jeff Thompson - 10 years ago