It seems like in order to do what you want, you don't really need regular expressions but can just go through the file character by character and parse it that way. It will be much easier than trying to figure out the regular expression and it won't be "read only" (meaning when you come back to the code later you'll know exactly what to do. Here is a class that I baked up for this (I haven't fully tested it but did do a quick test on a sample string and it works as advertised there):
public class Parser
{
bool inQuotes;
public Parser()
{
inQuotes = false;
}
public List<string> Parse(string input)
{
List<string> output = new List<string>();
StringBuilder temporaryString = new StringBuilder();
for (int i = 0; i < input.Length; i++)
{
if (input[i] == '\'' && !inQuotes)
{
inQuotes = true;
continue;
}
else if (input[i] == '\'' && inQuotes)
{
output.Add(temporaryString.ToString());
inQuotes = false;
temporaryString = new StringBuilder();
}
else if (inQuotes)
{
temporaryString.Append(input[i]);
}
}
return output;
}
}
This code will go through character by character and when it hits a single quote it will start "saving" the string until it hits another single quote. It will ignore all other characters and only focus on the characters inside the single quotes. Best of all, is you could adapt this to allow for nested quotes rather easily.