Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

extract url from string using jquery

var searchText = $('yourElement').text(),

    // urls will be an array of URL matches
    urls = searchText.match(/(http|https)?(://)?(S*).(w{2,4})/ig);

// you can then iterate through urls
for (var i = 0, il = urls.length; i < il; i++) {
    // do whatever with urls[i]
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #extract #url #string #jquery
ADD COMMENT
Topic
Name
6+8 =