Regex for c++ for loop conditions
There’s no better way of explaining than with an example:
say I have a for loop:
for(int i = 0; i
I basically want a regex that groups i = 0, i
so far, i have this:
for\s*\(\s*[^\w\s]?(\w+=\d+)\s*;\s*([^;]+)\s*;\s*([^)]+)\s*\)\s*({)?
and it gives me the i
I also need to account for when there are no type specifiers at all. I basically want to skip the first word if there are two words before the =. Is this a possible regular expression?
Read more here: Source link
