From 5fb0a995dd2d9cf65ed93fca78502f42a7c3e22d Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 5 May 2019 09:27:55 +0900 Subject: 様々な修正 (#4859) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Typo, Redundant code, Syntax error の修正 --- src/mfm/language.ts | 4 ++-- src/mfm/prelude.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mfm') diff --git a/src/mfm/language.ts b/src/mfm/language.ts index 207400d6d6..003ae348a4 100644 --- a/src/mfm/language.ts +++ b/src/mfm/language.ts @@ -129,7 +129,7 @@ export const mfmLanguage = P.createLanguage({ mention: () => { return P((input, i) => { const text = input.substr(i); - const match = text.match(/^@\w([\w-]*\w)?(?:@[\w\.\-]+\w)?/); + const match = text.match(/^@\w([\w-]*\w)?(?:@[\w.\-]+\w)?/); if (!match) return P.makeFailure(i, 'not a mention'); if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a mention'); return P.makeSuccess(i + match[0].length, match[0]); @@ -141,7 +141,7 @@ export const mfmLanguage = P.createLanguage({ }, hashtag: () => P((input, i) => { const text = input.substr(i); - const match = text.match(/^#([^\s\.,!\?'"#:\/\[\]【】]+)/i); + const match = text.match(/^#([^\s.,!?'"#:\/\[\]【】]+)/i); if (!match) return P.makeFailure(i, 'not a hashtag'); let hashtag = match[1]; hashtag = removeOrphanedBrackets(hashtag); diff --git a/src/mfm/prelude.ts b/src/mfm/prelude.ts index 7584389184..e18625bc7d 100644 --- a/src/mfm/prelude.ts +++ b/src/mfm/prelude.ts @@ -36,4 +36,4 @@ export function createTree(type: string, children: MfmForest, props: any): MfmTr return T.createTree({ type, props }, children); } -export const urlRegex = /^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.,=\+\-]+/; +export const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/; -- cgit v1.2.3-freya