I have the following code:
<?php
$text = 'Hey @Mathew, have u talked with @Jhon today?';
$text = preg_replace('/(^|\s)@([A-Za-z0-9]*)/', '\1<a href="profile.php?user=\\2">@\\2</a>',$text);
?>
And my goal is notify the user was quoted. To do that, I thought: I put all the replaced strings in a array and pick only the name; using the example above, and following the thinking, I have this result:
['Mathew', 'Jhon']
So, how can I have the last result?