Regular Expressions 101

Community Patterns

Match Ports

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^([^0-9]*\b(([1-9]|1[0-9]|22|2[4-9]|[3-9][0-9]|1[0-2][0-9]|13[0-6]|1[4-9][0-9]|[2-9][0-9][0-8]|[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])\b[^0-9]*)*$)
/
mg

Description

Match all Ports except 20,21,23,137,1378,139

Submitted by anonymous - 19 days ago