Regular to determine whether the site link address
Title for example to determine the site link format is a normal link http://bbs.csdn.net/topics/new?forum_id=PHPBase
Share to:
------Solution--------------------
Echo Filter_var ("Http://bbs.csdn.net/topics/new?forum_id=PHPBase", Filter_validate_url);
Http://bbs.csdn.net/topics/new?forum_id=PHPBase
Echo Filter_var ("Http:bbs.csdn.net/topics/new?forum_id=phpbase", Filter_validate_url);
Empty
See also: http://de3.php.net/manual/en/function.filter-var.php
------Solution--------------------
It works better upstairs, if you need a regular.
$reg = '/\b ((? #protocol) https?
------Solution--------------------
FTP): \/\/((? #domain) [-a-z0-9.] +) ((? #file) \/[-a-z0-9+&@#\/%=~_
------Solution--------------------
!:,.;] *)? ((? #parameters) \? [A-z0-9+&@#\/%=~_
------Solution--------------------
!:,.;] *)?/I ';