Example:
Given the string "check out google.com and also yahoo.com"
The regex will return google.com and yahoo.com
My current regex is
Code: Select all
<?php
$str = "check out google.com and also yahoo.com";
preg_match_all('/(?:http:\/\/)?(?:www\.)?[a-z0-9-_]+\.[a-zA-Z]{2,4}\/?.*(?:[[:space:]]|$)/Ui', $str, $matches);
?>Is there a way to tell the regex to not save the space in $matches?