Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
Python

r"
^(?P<port>[1-9]{1,4}|[1-5][\d]{1,4}|6[0-5]{2}[0-3][0-5])$
"
mg

Description

Validates port numbers from 1 to 65535

Submitted by Agustín Bouillet - 8 years ago