Q:

c# using regex to parse string between quotes

I'm fairly new and I couldn't get this to work properly.
I have this string

["string1","string2","string3","string4","string5","string6","string7","string8","string9","string10"]

And I want to get all values between the "
I think regex would be best to do the task.
Thanks for your help.

A:

This will capture between the quotes:
(?<=")[\w]+(?!=")

An expanded example:
string s = "[\"string1\",\"string2\",\"string3\",\"string4\",\"string5\",\"string6\",\"string7\",\"string8\",\"string9\",\"string10\"]";

foreach (Match m in Regex.Matches(s, "(?<=\")[\\w]+(?!=\")")) {
    Console.WriteLine(m.Value);
}

A:

Since this looks like JSON, try using the JavaScriptSerializer class
string myString = "[\"string1\",\"string2\",\"string3\",\"string4\",\"string5\",\"string6\",\"string7\",\"string8\",\"string9\",\"string10\"]";

string[] strings = (new JavaScriptSerializer()).Deserialize<string[]>(myString);

foreach (string str in strings)
{
    Console.WriteLine(str);
}

Kinda seems overkill though.

