package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^((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_]+)*))\)`)
var 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)
*/`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
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 Golang, please visit: https://golang.org/pkg/regexp/