Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2015-03-16 15:15
Flavor·PCRE (Legacy)

/
(?=\A[-a-z0-9]{1,63}\Z)\A[a-z0-9]+(-[a-z0-9]+)*\Z
/
mgi
Open regex in editor

Description

RFC 1123 compatible RegEx for a hostname (not a domain name), inspired by chapter 7.15 from Regular Expressions Cookbook.

Submitted by anonymous