Ok, I guess I fixed it. Don't ask what I did though... I only exchanged a few lines, added logging, streamlined the regex a bit, and then it worked. Must have been a trifle...
I ran a test project with a dozen different variables in various formats a couple of times and compiled Code::Blocks 1535 with itself without any warnings, so I guess it works