I want to write a perl regex to match a C/C++ multiline preprocessor macro. I came up with
\#([\W\w\s\d])*?(\n.*?\\\\)*\n
but it doesn't work.
#define protected_call(_name, _obj, _method, _args...) \
try { \
(_obj)->_method(_args); \
} \
catch (exception &e) { \
ereport(ERROR, \
errmsg("Error calling %s() in User Function %s at [%s:%d], error code: %d, message: %s", \
#_method, (_name), e.filename, e.lineno, e.errorcode, e.what()))); \
} \
catch (...) { \
ereport(errmsg("Unexpected exception calling %s() User Function in %s", \
#_method, (_udsfname)))); \
}