Regular Expressions 101

Community Patterns

localhost ip's with port

1

Regular Expression
Python

r"
^127\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:\d+)?$
"

Description

Matches localhost ip range with optional port capture: 127.X.X.X or 127.X.X.X:PORT

ToDo: check valid ip address.

Submitted by Rodrigo M. A. - 8 years ago