Can anyone help me with regex problem. Im making a script to go through all my .php files and get all strings passed to certain function. I need to match this cases:
/* Double quotes */
function("some string"); // Match: some string
function("some \"string\""); // Match: some "string"
function("some 'string'"); // Match: some 'string'
/* Single quotes */
function('some string'); // Match: some string
function('some \'string\''); // Match: some 'string'
function('some "string"'); // Match: some "string"
Function can also accept parameters after string, so it also needs to match this cases:
/* Additional parameters */
function("some string", "param"); // Match: some string
function("some string", $param); // Match: some string
So essentially, param can be either a string (quoted or double quoted) or unquoted variable. I need to get string only from first parameter of function, regardless if second parameter exists or is quoted in any way...
Thanks in advance...