I would like to find the following For Next loop within a script file. I have tried the following regex but doesn’t work. I cant figure out how to skip all the white spaces. The text in the middle of the For Next can vary as well.
RegEx…
/[fF]or [eE]ach.*[aA]s [lL]ist[iI]tem [iI]n .*\.[]tems\s*.*[nN]ext/
Seach for this…
For Each item As ListItem In CheckBoxList1.Items
If item.Selected = True Then
MyList.Add(item.Text)
End If
Next
If what is between For and Next can vary I think you are looking for:
This will match anything that looks like For(anything at all until the next:)Next
If matching more words as you describe I would use something like:
Let me know if you want a more detailed description of this, but your example in the comments below will not ensure the in between words are also there.