Bu kodu aşağıda tek tırnak işaretleri için çalışır aldım. tek tırnaklar arasındaki tüm kelimeleri bulur. ancak ikili tırnaklarla çalışmak için normal ifadeyi nasıl değiştirebilirim?Regex.Matches C# çift tırnak işareti
anahtar öylesine
keywords = 'peace "this world" would be "and then" some'
// Match all quoted fields
MatchCollection col = Regex.Matches(keywords, @"'(.*?)'");
// Copy groups to a string[] array
string[] fields = new string[col.Count];
for (int i = 0; i < fields.Length; i++)
{
fields[i] = col[i].Groups[1].Value; // (Index 1 is the first group)
}// Match all quoted fields
MatchCollection col = Regex.Matches(keywords, @"'(.*?)'");
// Copy groups to a string[] array
string[] fields = new string[col.Count];
for (int i = 0; i < fields.Length; i++)
{
fields[i] = col[i].Groups[1].Value; // (Index 1 is the first group)
}
o dizede tırnak koymak için işe misiniz:
bu durumda böyle bir şey yapmak isteyebilirsiniz? @ -strings "" yerine "" yerine "." @ "" "(. *?)" "" ' –