Right now I have the code:
$msgs = preg_replace('/(?<=^|\s)@([a-z0-9_]+)/i', '$1', $msg);
Let's say that
$msg = "@Admin Hello my friends";
The code works above but I need to get just the tagged name! I need to get just "Admin", all the persons who have been tagged. How do I do that?
You can do:
or
If you can have more than one
@
in a single line, use preg_match_all: