string pattern = @"(if)|(\()|(\))|(\,)";
string str = "IF(SUM(IRS5555.IRs001)==IRS5555.IRS001,10,20)";
string[] substrings = Regex.Split(str,pattern,RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase) ;
foreach (string match in substrings)
{
Console.WriteLine("Token is:{0}", match);
}
And out put is
Token is:
Token is:IF
Token is:
Token is:(
Token is:SUM
Token is:(
Token is:IRS5555.IRs001
Token is:)
Token is:==IRS5555.IRS001
Token is:,
Token is:10
Token is:,
Token is:20
Token is:)
Token is:
As you can see Empty string in 1,3 and last token,i am not able to understand why this kind of result,there is not empty string in my given string.
i don’t want this is result
try that :