私はこの引用符をシングルクォートで使用できます。 シングルクォート間のすべての単語を検索します。 しかし、二重引用符で動作するように正規表現を変更するにはどうすればよいですか?Regex.Matches c#二重引用符
キーワードは
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)
}
は、それが文字列に引用符を入れて動作しませんか? @ -stringsは、引用符に ""の代わりに ""を使用します。 '@" ""(。*?) "" " –