I need you help I have one string like
a1 + b1 + ( v1 + g1 ) * 10
I need to retrieve only a1,b1,v1,g1 any idea
I need you help I have one string like
a1 + b1 + ( v1 + g1 ) * 10
I need to retrieve only a1,b1,v1,g1 any idea
I would use RegEx to filter the desired output.
Assuming that your result always starts with a small letter and ends with a digit [a-z][0-9]
string input = "a1 + b1 + ( v1 + g1 ) * 10";
List<string> Result = Regex.Matches(input, @"[a-z][0-9]")
.Cast<Match>()
.Select(x => x.Value)
.ToList();
I'd go after it using a recursive descent parser. It may seem as an overkill to start with but it will work for all sorts of expressions.