Isn't it possible to use 'Repeats' in the lookaheads for boost:regex?
Question
I'm trying to extract some variables in my C++ code nested in blocks
for example, if I have
DEL_TYPE_NONE,
DEL_TYPE_DONE,
DEL_TYPE_WAIT,
I'd like to match
"DEL_TYPE_NONE"
"DEL_TYPE_DONE"
"DEL_TYPE_WAIT"
I made my pattern like this,
std::string pat("(?<=^[ \\t]?)[A-Z0-9_]+(?=,$)");
but I'm keep getting error message when compiler is tyring to read my pattern.
I don't understand but there is problem with ? mark after \\t
If I get rid of ? mark then it compiles and find only "DEL_TYPE_WAIT"
why can't I use Repeats in the Lookahead? plz help me I'm totaly lost here ;(
thank you
Solution
I found the answer. No from this manual
Lookbehind
(?<=pattern) consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).
OTHER TIPS
Just based on POSIX I'd say your regex is "DEL_TYPE_([ND]ONE|WAIT),"
That's just based on what you've listed above. I would say that the actual issue is with you double escaping the t; you should probably do [ \t\s]* since there may not be just zero or one tab/space.