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
This means either
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.
mmyers' answer will perform a paren capture; mine won't. Which you should use depends on whether you want the paren capture.