Extract @Mentions
Pull @username mentions out of text — social-media posts, chat transcripts, and the like.
0 mentions found
About Extract @Mentions
The mention extractor scans for @-prefixed handles, skipping ones inside email addresses (so foo@bar.com isn't matched). It accepts Unicode letters, digits, underscores, dots, and hyphens after the @ — covering Twitter/X, GitHub, Mastodon, and similar handle formats.
When to use it
- Collecting @mentions from a social-media post
- Building a list of users tagged in a chat transcript
- Auditing a document for handles referenced
- Cross-referencing mentions across multiple posts
How it works
The regex looks for an @ that is either at the start of the input or follows a non-word character, then captures a run of Unicode letters, digits, underscores, dots, and hyphens. Mentions inside email addresses are skipped because the character preceding the @ is a word character.
Examples
Email-style @ is correctly skipped
Cc @alice and @bob.dev. Email goes to alice@example.com.
@alice @bob.dev
Frequently asked questions
- How are email addresses distinguished from mentions?
- An @ that immediately follows a word character (letter or digit) is treated as part of an email and skipped. Only @s at the start of a string or after whitespace/punctuation are extracted.
- Are dots and hyphens included?
- Yes — handles can contain ., _, and - (matching Mastodon, GitHub, and Twitter-style names).