Regular Expressions 101

Community Patterns

1...34567...467

FQDN Fully Qualified Domain Name

1

Regular Expression
PCRE (PHP <7.3)

/
^((([a-z0-9][a-z0-9\-]*[a-z0-9])|[a-z0-9]+)\.)*([a-z]+|xn\-\-[a-z0-9]+)\.?$
/

Description

  • Allow only two or more labels.
  • Fix deprecated FQDN regexp not passing on test "dicas-l.com.br"
Submitted by Rafael Justo and Mauro Trajber - 9 years ago