$re = '/^((struct *[a-z0-9_]+)|[a-z0-9_]+) *[*a-z0-9_]+\((void|((((struct *[a-z0-9_]+)|[a-z0-9_]+) *[*a-z0-9_]+)(, ((struct *[a-z0-9_]+)|[a-z0-9_]+) *[*a-z0-9_]+)*))\)/m';
$str = 'int a_0(void)
int b_1(int a)
int c_2(int a, int b)
void *xmalloc(size_t n)
int main(int argc, char **argv)
void *xmalloc(size_t n)
void release(struct s_block)
int a_(int a, int b)
int main(void)
struct student get_student(char *name)
struct student *grow_2fast(struct student *s, int age_diff)
struct student *grow_2fast(struct student *s, struct hello age_diff)
int main(void)
int print_me(int h1)
/*
**int main(void)
*/';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php