Fix username/mention regexes
* Allow underscore instead of hypen * Fix domain part handling * Add tests for remote mention
This commit is contained in:
parent
34281de04e
commit
3c4235067f
6 changed files with 17 additions and 7 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue