Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r'''
\b[\(|\[]?(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]) \. (25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]) \. (25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]) \. (25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])[\]|\)]?\b
'''
x

Description

Search and Match an IP address in a string that may have either () or [] as boundaries.

Submitted by anonymous - 5 years ago