Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
^(?=.{3,256}$)((?:[a-z0-9-]{2,65}\.)?[a-z0-9-]{2,256}\.[a-z\.]{2,6})$
/
img

Description

Ideal for filter Domain with or without subdomain, and length less than 256.

Submitted by Presta-Lab - 9 years ago