Regular expressions and text scanning
use text\regex\Pattern;
$pattern= Pattern::compile('([w]{3}\.)?example\.(com|net|org)');
if ($pattern->matches($input)) {
// Looks like an example domain
}
$result= $pattern->match($input);
$group= $result->group(0); // [ "www.example.com", "www.", "www", "com" ]