Files
gerbeur/shared/mention.ts

14 lines
398 B
TypeScript

/**
* The @mention pattern, one for the server and the chat.
*
* @module
*/
/**
* Matches @username not already inside a markdown link ([...] or (...)) and
* not mid-word, so an email address doesn't mention its domain; the name is
* the first group. The server notifies whoever it matches; the chat highlights
* the same names.
*/
export const MENTION_RE: RegExp = /(?<![[(\w])@(\w+)/g;