Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
^(((?!-))(xn--|_{1,1})?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9\-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})$
"
gm

Description

Validate that the string is a domain name (internationalization supported)

Submitted by anonymous - 5 years ago