Find for loops with Search with Pattern


Is there a way to search for all the for loops no matter if they have the form "for(i = 0; i<10; i++)" or "for(int i = 0; i<10; i++)"?

I tried the following but it matches only the first pattern:

   for($exp$; $exp2$; $exp3$){

Where exp, exp2 and exp3 are expressions with no type and stmts1 is any number of statements.

I couldn't figure out how to make a pattern to mach the for loop with a declaration. Note that int is used in the sample but I'm looking to match absolutely all the for loops regardless of the type of the variable, the condition or increment expression.

Thanks for the help.

Please sign in to leave a comment.