method isDomain documentation in bbn\Str

Checks if the argument is a valid domain name.

Example

X::dump(\bbn\Str::isDomain("http://bbn.so")); // (string) false X::dump(\bbn\Str::isDomain("bbn.so")); // (bool) true function($st) { return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $st) //valid chars check && preg_match("/^.{1,253}$/", $st) //overall length check && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $st) ); //length of each label }

Checks if the argument is a valid domain name. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.