Wraps all URLs in anchor tags with a href and target inside some given text.
| Name | Type | Description |
|---|---|---|
| text | String | The text that may or may not containing URLs. |
| new_window | Boolean | Determines if the URLs should be opened in a new window (optional - defaults to true). |
Returns a String in which URLs have been replaced with anchors tag linking to the URL.
wrapURLs('Google is pretty awesome! Take a look at http://www.google.com.');
// Returns 'Google is pretty awesome! Take a look at <a href="http://www.google.com" target="_blank">http://www.google.com</a>.'The URL Regex used here is taken from @diegoperini submission at https://mathiasbynens.be/demo/url-regex.


google.com