How to compare string with for loop in c# : <p>I'm creating a mini code generator in c#.  Say i have a string</p>

<p>string val= "i=0;i&lt;5;i++";</p>

<p>As I'm taking complete structure of for loop as a string. How to find the syntax error if user gives wrong input? For example terminator missing or other logical errors? Should i have to use regex? </p>
