const regex = new RegExp('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_\\@.&+]|[!*\\'(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', 'gm')
const str = `Xem thêm nội dung được đề xuất cho riêng bạn. https://vt.tiktok.com/ZSFNnnkf2/
Xem thêm nội dung được đề xuất cho riêng bạn. https://vt.tiktok.com/ZSFNnnkf2/
5.17 Xzt:/ 10/13 H@i.pQ QQ炫舞系列赠送龙年多重好礼,无需下载点开即玩! # QQ炫舞 # 游戏 # 龙年 https://v.douyin.com/iNYLXGru/ 复制此链接,打开Dou音搜索,直接观看视频!
0.51 p@q.Rx lpD:/ 12/19 真的好浪漫啊,公主请看@ https://v.douyin.com/iNYNd6Ns/ 复制此链接,打开Dou音搜索,直接观看视频!
Xem thêm tại https://www.facebook.com/story.php?story_fbid=pfbid0YNXQNNzHc39zjUhbMar7Fh2UsjooeemZkLJpQ1Q3phq8QvtEAY1Rc75qatoi6ku3l&id=100064769740799&mibextid=Nif5oz
xem thêm https://www.facebook.com/share/v/VDjQdshbUq72CQbe/?mibextid=oFDknk`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions