I want to group the words starting with character $ from the text area content . This is the editor content. Example paragrraph:
Hi $firstname, Please find the company credentials mentioned below: Employee Name: Employee ID: Employee username: $username Email ID: $email Password: $password Regards, Administration Team
My Code:
$pattern = '/([$])\w+/';
preg_match($pattern, $input, $matches);
print_r($matches);
Output is :
Array (
[0] => $firstname
[1] => $
)
I need the output to be:
Array (
[0] => $firstname
[1] => $username
[2]=>$email
[3]=>$password
)
What am I doing wrong?