Regex for Matching an @ Mention

Matches an @ symbol followed by a username made of word characters.

Published October 12, 2026

Matches an @ symbol followed by a username made of word characters.

Key points

  • The same basic pattern is used across most platforms (Twitter/X, GitHub, Slack) for parsing @mentions out of text

Example

@\w+
More General articles