extract urls from string javascript code example Example: extract urls from string javascript //use the regex let url = string.match(/\bhttps?:\/\/\S+/gi);