From dbbc416095ae39541dc3f3de1ce24966a290ac61 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 24 Nov 2018 17:18:11 +0900 Subject: [MFM] Fix hashtag detection --- src/mfm/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mfm/parser.ts b/src/mfm/parser.ts index 5a20c7ef2b..3edb23b602 100644 --- a/src/mfm/parser.ts +++ b/src/mfm/parser.ts @@ -112,7 +112,7 @@ const mfm = P.createLanguage({ const text = input.substr(i); const match = text.match(/^#([^\s\.,!\?#]+)/i); if (!match) return P.makeFailure(i, 'not a hashtag'); - if (match[1].match(/[0-9]+/)) return P.makeFailure(i, 'not a hashtag'); + if (match[1].match(/^[0-9]+$/)) return P.makeFailure(i, 'not a hashtag'); if (input[i - 1] != '\n' && input[i - 1] != ' ' && input[i - 1] != null) return P.makeFailure(i, 'require space before "#"'); return P.makeSuccess(i + match[0].length, makeNode('hashtag', { hashtag: match[1] })); }), -- cgit v1.2.3-freya