I Want to match the below Code
with my Regex,
Simply say I want to match the whole for loop
statement starting from for
and ending with the }
.
This is what I tried, but In my approach I have to give \R
exactly the same times as the number of lines in the for loop
, Can it be dynamic ? Or is there a better solution.
Please tell me
Here is my code for Regex
for.+\(.*\R.*\R.*\R.*\R.*\R.*\R.*
And this is what I want to match
for (i = 2; i <= n / 2; ++i) {
// condition for non-prime
if (n % i == 0) {
flag = 1;
break;
}
}