I'm using this preg_replace to find links in tweet text and it dutifully returns an HTML link but I wonder if it's possible to, in the same line, lose the http:// from the link text. For example:
$output .= preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a target="blank" rel="nofollow" href="$1" target="_blank">$1</a>', $status->text);
might return:
<a target="blank" rel="nofollow" href="https://kanyewest.com/">https://kanyewest.com</a>
but I'd really like it to return:
<a target="blank" rel="nofollow" href="https://kanyewest.com/">kanyewest.com</a>
$4with$4$5inside the replace argument.