Hi all,
I need to parse a source file (through PHP) and pull out all references to a particular variable ($ST). The references can come in one of three forms and I need to be able to detect any/all of them:
<?= $ST['var_name'] ?>
{$ST['nother_var_name']}
$ST['yet_nuther_varname']
I need to be able to pull them out and chuck them straight into array so I'm thinking regex is the way to go problem is, my regex skills are a little ... weak ... right now 🙂
So, I've cobbled something together but it's the tiniest bit lame and I'm hoping someone can suggest a better way to find the target strings and pass them out to an array.
My current "effort" is :
<\?= \$ST. \?>|\{$ST\[.\]}|{\$ST.*]}
Any help on tidying this up would be grately appreciated!!!!
TIA
Chris