When trying to parse a string a string for mentions I was using this regex: .*@${username}.*
where ${username}
is a parameter.
if ${username} = 'c'
then this becomes .*@c.*
so this will incorrectly match something like hello @cat
.
I need a regex that matches the entire string:
@c
hello @c
@c hello
hello @c hello
and does not match:
@cat
- It doesn't have to be one regex. It could be multiple ones that cover all cases without interfering with another case.