I got the following code
$original_file=str_replace('<?php','',file_get_contents('file.txt'));
//regular expression to get anything that starts with '$' and end with ';'
preg_match_all("/\\$(.*?);/",$original_file,$matches,PREG_PATTERN_ORDER);
I have succeeded in the getting the variables or anything starting with the '$', But now I am trying to modify that regular expression to lookbehind the $ and check if it is preceded by the \ comments keywords. if it is then don't get it.Does someone have a good suggestion? I am using PHP preg_match_all as you can see above. Any help is appreciated.