Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^([1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[1-5])$
/
gm

Description

Validate a unsigned integer in the range 1-65535 This can for example be a UDP or TCP port number

Submitted by anonymous - 5 years ago