I’m not fond of them, but sometimes they can do their job regex – Regular expression to match DNS hostname or IP Address? – Stack Overflow
Two notes:
- The first answer matches either IPv4 or hostname
(no IPv6 support yet; reminder to self: find it one day). - The second answer restricts the hostname parts to be no more than 63 characters each. It doesn’t fix the total length being 255 or less
(reminder to self: create that restriction one day).








![[ ]](https://wiert.me/wp-content/uploads/2016/10/layout.gif)
![[IMG]](https://wiert.me/wp-content/uploads/2016/10/image2.gif)
