Have you also tried something already? Do that next time before you post something. Ok but since you're from Holland and I'm too I should give you a little hint.
To identify the words starting with $:
(In this example all words are in this string $text)
preg_match_all("/\$[a-zA-Z0-9]* /", $text, $matches);
Now you have all the words you want as array in $matches.
Have fun!
Regards,
Rik