I want to match either @ or 'at' in a regex. Can someone help? I tried using the ? operator, giving me /@?(at)?/ but that didn't work
Try:
/(@|at)/
This means either @ or at but not both. It's also captured in a group, so you can later access the exact match through a backreference if you want to.
@
at
2.1m questions
2.1m answers
60 comments
57.0k users