C# regex to parse PHP function call list file -
i have simple problem. have php file contains lot of function-calls one:
return self::_call('client_changepassword',array( $token, $password, $user_token )); the name , number of parameters can vary call have structure, including spaces , linebreaks.
what need regular expression grab these calls php file , split them function name (client_changepassword) , group of parameters. since file has several hundreds of different calls, needs reasonably fast, too.
the regular expression used within c# part of console application generate simple code analysis. basically, need list of methods plus parameters php calls in source , compare list of definitions stored in different project. our code reviews lot.
no, not php-related though i'm trying parse php code. system can't run php code , don't want run php code.
you can use following regex:
return\s+self::_call\('(?<name>[^']+)'\s*,\s*[aa]rray\((?:\s+\$(?<param>[^,)\n]+),?\r?\n)+ see demo

Comments
Post a Comment