I have a code on a webpage in the following pattern::
I need to extract the body of the first for loop, so I start reading from the first curly braces, what logic should I have to keep reading till the last curly brace (I need to extract the body of the parent for loop, there are multiple parent for loops one after another.
Code:
for (anything might be here) {
this is the Start of the parent for loops body
for (anything might be here) {
this is the Start of the child for loops body
for (anything might be here) {
this is the Start of the 2nd child for loops body
if {
}
2nd child for loop closes here }
1st child for loop closes here }
Parent for loop closes here }
I need to extract the body of the first for loop, so I start reading from the first curly braces, what logic should I have to keep reading till the last curly brace (I need to extract the body of the parent for loop, there are multiple parent for loops one after another.