I am a novice with Regex usage in C#. I want a regex to find the next keyword from a given list but which is not surrounded by the quotes.
e.g. if i have a code which looks like:
while (t < 10)
{
string s = "get if stmt";
u = GetVal(t, s);
for(;u<8;u++)
{
t++;
}
}
i tried using the Regex as @"(.*?)\s(FOR|WHILE|IF)\s" but it gives me the "if" as next keyword. whereas, i want to get the next keyword after while as "for" and not as "if" which is surrounded by quotes.
Can it be done in anyway using Regex? Or i will have to use conventional programming?