diff options
| author | unarist <m.unarist@gmail.com> | 2018-04-09 01:10:04 +0900 |
|---|---|---|
| committer | unarist <m.unarist@gmail.com> | 2018-04-09 01:52:41 +0900 |
| commit | 3c4235067f2ff1f8057080482559a8015f0492c6 (patch) | |
| tree | 8ed49d9d10af0e7f9f70b27cb7dfb6f0173b0d4a /src/text/parse/elements | |
| parent | Merge pull request #1420 from unarist/fix/banner-selection (diff) | |
| download | misskey-3c4235067f2ff1f8057080482559a8015f0492c6.tar.gz misskey-3c4235067f2ff1f8057080482559a8015f0492c6.tar.bz2 misskey-3c4235067f2ff1f8057080482559a8015f0492c6.zip | |
Fix username/mention regexes
* Allow underscore instead of hypen
* Fix domain part handling
* Add tests for remote mention
Diffstat (limited to 'src/text/parse/elements')
| -rw-r--r-- | src/text/parse/elements/mention.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/text/parse/elements/mention.ts b/src/text/parse/elements/mention.ts index 4f2997b39f..2ad2788300 100644 --- a/src/text/parse/elements/mention.ts +++ b/src/text/parse/elements/mention.ts @@ -4,7 +4,7 @@ import parseAcct from '../../../acct/parse'; module.exports = text => { - const match = text.match(/^(?:@[a-zA-Z0-9\-]+){1,2}/); + const match = text.match(/^@[a-z0-9_]+(?:@[a-z0-9\.\-]+[a-z0-9])?/i); if (!match) return null; const mention = match[0]; const { username, host } = parseAcct(mention.substr(1)); |