Regular Expressions 101

Community Patterns

match @user but not email@example.com

1

Regular Expression
PCRE (PHP <7.3)

/
((?:(?<=\s|\W|\A))@(\w+))
/
gi

Description

for finding user mentions in markdown-like comments

Submitted by Holger Schmidt (https://github.com/forger) - 8 years ago