diff --git a/angular-linkify.js b/angular-linkify.js index a00f413..52f44a0 100644 --- a/angular-linkify.js +++ b/angular-linkify.js @@ -24,16 +24,19 @@ angular.module('linkify') return ''; } + // Email + _text = _text.replace(/((([a-zA-Z]|[0-9])|([-]|[_]|[.]))+[@](([a-zA-Z0-9])|([-])){2,63}[.](([a-zA-Z0-9]){2,63})+)/g, '$1'); + // Twitter if (type === 'twitter') { - _text = _text.replace(/(|\s)*@([\u00C0-\u1FFF\w]+)/g, '$1@$2'); + _text = _text.replace(/(^|\s)*@([\u00C0-\u1FFF\w]+)/g, '$1@$2'); _text = _text.replace(/(^|\s)*#([\u00C0-\u1FFF\w]+)/g, '$1#$2'); } // Github if (type === 'github') { - _text = _text.replace(/(|\s)*@(\w+)/g, '$1@$2'); + _text = _text.replace(/(^|\s)*@(\w+)/g, '$1@$2'); } return _text;