I want to write a RegEx to pull out all the variable values and their names from the variable declaration statement. Say i have
int i,k = 10,l=0
i want to wr
Try this:
^(int|[sS]tring)\s+\w+\s*(=\s*[^,]+)?(,\s*\w+\s*(=\s*[^,]+)?)*$
It'll match your example code
And making a few assumptions about the language you may or may not be using, it'll also match:
int i, j, k=10, l=0 string i=23, j, k=10, l=0