如何使用php解析HTML和预格式化[关闭]

I have text like this Too early to post? http://www.somewebsite.com/article/226973 I want to parse the hyperlinks in the text and make the text look like so Too early to post? <a href="http://www.entrepreneur.com/article/226973" target="_blank">http://www.entrepreneur.com/article/226973</a> I want to do this but I have no idea where to start from or what regexp to use.

$s = 'Too early to post? https://www.somewebsite.com/article/226973'; 
$parsed = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $s); 
echo $parsed;