mentionRegex

fun mentionRegex(display: String): Regex

Builds the regex used to locate a mention token (@<display>) inside message text.

The boundaries use Unicode-aware lookaround, because Java's default word-boundary classes only recognize ASCII [A-Za-z0-9_]. The lookbehind (?<![\p{L}\p{N}_]) also naturally handles the start-of-string case.

An empty display returns a regex that never matches, to prevent a bare @ regression.

Parameters

display

The literal display text of the mention (without the leading @).