If you want to re-use a group, you could use recursion:
/([a-zA-Z0-9\-])(@)(?1)/
(?1)
will use the pattern from group 1. Let's now polish your regex:
- Remove unnecessary group:
/([a-zA-Z0-9\-])@(?1)/
- We don't need to escape a hyphen at the end of a character class:
/([a-zA-Z0-9-])@(?1)/
- Let's use the
i
modifier:/([a-z0-9-])@(?1)/i
Further reading: