JSFiddle - React, Tailwind, and code Playground
JavaScript
var text = "I go to google.com to search, to facebook.com to share and to yahoo.com to send an email.";
var pattern = /\w+\.\w+/g;
var matches = text.replace(pattern,function($0){alert($0);});