Skip to main content

parse_mentions

Function parse_mentions 

Source
pub fn parse_mentions(content: &str) -> Vec<String>
Expand description

Extract @mentions from message content.

Matches @username patterns where usernames can contain alphanumerics, hyphens, and underscores. Stops at whitespace, punctuation (except - and _), or end of string. Skips email-like patterns (user@domain) by requiring the @ to be at the start of the string or preceded by whitespace.

Returns a deduplicated list of mentioned usernames (without the @ prefix), preserving first-occurrence order.