javascript - How to check if string contain the "url or link" and retrieve it -
this question has answer here:
i have comment section of page user can post comments on uploaded content, want check if user has shared url links in comment.
for example -
var comment = "to search more on question can http://stackoverflow.com/ "
now how find out url link , retrieve link?i great if can find way in jquery
, java script
php
acceptable.
thanks in advance.
try use regex
((http:\/\/|https:\/\/)?(www.)?(([a-za-z0-9-]){2,}\.){1,4}([a-za-z]){2,6}(\/([a-za-z-_\/\.0-9#:?=&;,]*)?)?)
Comments
Post a Comment