This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('parseUrl', function () { | |
var replacements = [ | |
{ | |
//URLs starting with http://, https://, or ftp:// | |
search: /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim, | |
replace: '<a href="$1" target="_blank">$1</a>' | |
}, | |
{ | |
//URLs starting with "www." (without // before it, or it'd re-link the ones done above). | |
search: /(^|[^\/])(www\.[\S]+(\b|$))/gim, |