diff --git a/common/at.js b/common/at.js index 62960df..8ed1628 100644 --- a/common/at.js +++ b/common/at.js @@ -24,7 +24,7 @@ var fetchUsers = function (text) { /```[\s\S]+?```/g, // ``` 里面的是 pre 标签内容 /`[\s\S]+?`/g, // 同一行中,`some code` 中内容也不该被解析 /^ .*/gm, // 4个空格也是 pre 标签,在这里 . 不会匹配换行 - /@[^\s]*?\..+?/g, // somebody@gmail.com 会被去除 + /@[^\s]*?\..+?\b/g, // somebody@gmail.com 会被去除 ]; ignore_regexs.forEach(function(ignore_regex) { diff --git a/test/common/at.test.js b/test/common/at.test.js index bf89738..cde0210 100644 --- a/test/common/at.test.js +++ b/test/common/at.test.js @@ -34,7 +34,7 @@ describe('test/common/at.test.js', function () { Text 中文@begin_with_no_spaces @end_with_no_space@begin_with_no_spaces - jysperm@gmail.com + jysperm@gmail.com @alsotang @ @@ @@ -52,36 +52,36 @@ describe('test/common/at.test.js', function () { ``` */}); - var matched_users = ['A-aZ-z0-9_', 'begin_with_spaces', 'multi_in_oneline', 'around_text', 'end_with_no_space', 'begin_with_no_spaces', 'end_with_no_space', 'begin_with_no_spaces']; + var matched_users = ['A-aZ-z0-9_', 'begin_with_spaces', 'multi_in_oneline', 'around_text', 'end_with_no_space', 'begin_with_no_spaces', 'end_with_no_space', 'begin_with_no_spaces', 'alsotang']; var linkedText = multiline.stripIndent(function(){/* - [@A-aZ-z0-9_](/user/A-aZ-z0-9_) - @中文 - [@begin_with_spaces](/user/begin_with_spaces) [@multi_in_oneline](/user/multi_in_oneline) - Text More Text [@around_text](/user/around_text) ![Pic](/public/images/cnode_icon_32.png) - [@end_with_no_space](/user/end_with_no_space)中文 - Text 中文@begin_with_no_spaces - [@end_with_no_space](/user/end_with_no_space)@begin_with_no_spaces +[@A-aZ-z0-9_](/user/A-aZ-z0-9_) +@中文 + [@begin_with_spaces](/user/begin_with_spaces) [@multi_in_oneline](/user/multi_in_oneline) +Text More Text [@around_text](/user/around_text) ![Pic](/public/images/cnode_icon_32.png) +[@end_with_no_space](/user/end_with_no_space)中文 +Text 中文[@begin_with_no_spaces](/user/begin_with_no_spaces) +[@end_with_no_space](/user/end_with_no_space)[@begin_with_no_spaces](/user/begin_with_no_spaces) - jysperm@gmail.com +jysperm@gmail.com [@alsotang](/user/alsotang) - @ - @@ +@ +@@ - `@code_begin_with_no_space` - code: `@in_code` +`@code_begin_with_no_space` +code: `@in_code` - @in_pre + @in_pre - ``` @in_oneline_pre ``` +``` @in_oneline_pre ``` - ``` - Some Code - Code @in_multi_line_pre - ``` +``` + Some Code + Code @in_multi_line_pre +``` */}); - describe.only('#fetchUsers()', function () { + describe('#fetchUsers()', function () { var fetchUsers = at.fetchUsers; it('should found 6 users', function () { var users = fetchUsers(text);