I'm trying to learn regex, have watched multiple tutorials and checked multiple websites, but can't fully grasp how to use it for my specific situation. I want to find and retrieve a certain part out of a string: the word that follows an @. currently I have this:
^@[a-zA-Z0-9]+$
^@[a-zA-Z0-9]+$
Here are some example cases:
word @something
word @something
-> true
@something
@something
-> true
word@something
word@something
-> false I'd like to be able to retrieve the
@something
@something
from those examples, whilst ignoring the rest. Would my regex work? I've tried it with this website (https://regexr.com) but it doesn't seem to work...