I have a regex that works perfectly with pcregrep
:
pcregrep -M '([a-zA-Z0-9_&*]+)(\(+)([a-zA-Z0-9_ &\*]+)(\)+)(\n)(\{)'
Now I tried to include this regex in my C++ code but it does not match (escapes included):
char const *regex = "([a-zA-Z0-9_&*]+)\\(+([a-zA-Z0-9_ &\\*]+)\\)+(?>\n+)\\{+";
re = pcre_compile(regex, PCRE_MULTILINE, &error, &erroffset, 0);
I'm trying to find function bodies like this (the paragraph is 0a
in hex):
my_function(char *str)
{
Why does it work with pcregrep
and not within the C++ code?