string[] num = Regex.Split(expr, @"\(|\)|\-|\+|\*|\/").Where(s => !String.IsNullOrEmpty(s)).ToArray();
For this I am getting operators and braces.
string[] num = Regex.Split(expr, @"\(|\)|\-|\+|\*|\/").Where(s => !String.IsNullOrEmpty(s)).ToArray();
For this I am getting operators and braces.
Use lookaround i.e lookahead and lookbehind to split the input
(?<=\(|\)|\-|\+|\*|\/)|(?=\(|\)|\-|\+|\*|\/)
^
Without lookaround the regex engine would split on those characters and eat it i.e it won't show it in the result
If you want to evaluate mathematical expressions,have a look at these