I am using .NET\'s String.Split method to break up a string using commas, but I want to ignore strings enclosed in double quotes for the string. I have read that a
For
if using c#, you can use
string searchQuery = "Fruit,10,\"Bananas, Oranges, Grapes\""; List list1 = Regex.Matches(searchQuery, @"(?\w+)|\""(?[\w\s,]*)""").Cast().Select(m => m.Groups["match"].Value).ToList(); foreach(var v in list1) Console.WriteLine(v);
Output :
Fruit
10
Bananas, Oranges, Grapes