Ok, I'm trying to get hostnames and i'm using this regex:
preg_match_all("/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/", 'google.com some text example.com', $matches);
print_r($matches[0]);
Matches should be:
google.com
example.com
but, the output is the first match only (google.com)
What i should change to get all matches please?