Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2018-11-17 04:36
Flavor·PCRE (Legacy)

/
^([0-9]|[1-9][0-9]|[1-9][0-9]{2}|[1-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$
/
gm
Open regex in editor

Description

Matches a TCP or UDP port. This will only match a string of digits between 0-65535.

It does not support zero-padded ports.

Submitted by anonymous