Let's say I have
$funcName = 'FooBar';
$myFuncString = $funcName.'("Arg1, Arg2")';
How could I preg_match() so it returns "Arg1, Arg2" (with doubles quotes and without $funcName?
I have tried:
$pattern = '/(?:'.$funcName.'|\".*?)\"/';
preg_match($pattern, myFuncString, $matches);
It returns "Arg1, Arg2" even if $funcName does not match. Any suggestions?
preg_matchstores what is captured.$funcNamein the string? Your current regex has anorthere. You also are using a non-capture group but I think you do want to capture part of this..myFuncString!=$myFuncString.