Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SQL コマンドを含む次の文字列があります。
string sql = "select [x] from table where field = [y] order by [w], [z]";
(x、y、w、z など)内のキーを取得したいのですが[brackets]、C# でこれを行うにはどうすればよいですか? 正規表現でそれを行う方法はありますか(必須ではありません)?
[brackets]
ステートメントで何かをしようとしましたが、うまくいきwhileません。
while
ありがとうございました
string sql = "select [x] from table where field = [jkjlh] order by [w], [z]"; var matches = Regex.Matches(sql,@"\[(.*?)\]"); var result = Enumerable.Cast<Match>(matches).Select(m => m.Groups[1].Value).ToList();
結果には、キーを含む文字列のリストが含まれます。