I only need the regex to return to me the two parameters and ONLY if they are strings...so is it possible for regex to do this or will the likely hood of escaped double/single quotes cause regex to choke???
Should I use PHP tokenizer for this problem instead?
$pattern = "/->[\w]*\("(.*)","(.*)"\)/";
preg_match_all($pattern,$code,$matches);
//$matches should now contain all the string arguments
However, this won't catch object methods if variables are passed as parameters, or if they are wrapped in single quotes (not hard to make another pattern to catch those though
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
$pattern = "/->[\w]*\("(.*)","(.*)"\)/";
preg_match_all($pattern,$code,$matches);
//$matches should now contain all the string arguments
However, this won't catch object methods if variables are passed as parameters, or if they are wrapped in single quotes (not hard to make another pattern to catch those though
Pickles wont work... too greedy unfortunately (.*) ... the below regex will work with a two paramater method call as long as both paramaters are double-quoted strings. It has some whitespace flexibility too. You'll need to write a function with a few stages if you want to extract any number of parameters which could be of varying types.