I'm writing a regex to extract every element of a line of a basic C++ function call including parameters.
So far I came with this:
(?:([\w]+)((?:->|\.)))?([\w]+)(?:(\()((?:[\w]+|\"[^"]*?\"|))(?:\s*(,)\s*((?:[\w]+|\"[^"]*?\"|)))*(\)))
With this example:
test->log(IL_Info,"a", b, c)
What I am able to achieve is getting those elements
- test
- "->"
- log
- "("
- IL_Info
- "," (the last comma)
- c
- ")"
So I can get the first and last argument (including the last comma) but not everything in between, and I can't quite figure out what.
Actually I'm testing this on. regex101
Here's another list of examples I'm testing it on
append(apNewTask)
append(a, b)
pSenderTimer.property("trigger")
pSenderTimer->property("id")
scheduler.runTask(fpSchedulingTask)
and they're all working fine as long as there is no more than 2 parameters
clang
, that that is not what you have asked for. – hochl Nov 8 '18 at 20:48