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.
文字列内の英数字以外のすべての文字をダッシュに置き換えるか、単一引用符とアンダースコアの場合は何も置き換える必要はありません。regex クラスを使用して C# でこれを行う方法に関する提案はありますか?
var result = System.Text.RegularExpressions.Regex.Replace(input, @"[^a-zA-Z0-9]", m =>(m.Value == "'" || m.Value == "_") ? "" : "-");