<?php
$regex = '@(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))@';
var_dump( preg_match($regex, 'http://segmentfault.com/q/1010000000584340') ); //true
若想自动添加<a>标签则执行
$content = preg_replace($preg, '<a href="$1">$1</a>', $content);