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.
C#で次の正規表現を使用しようとしています
<asp:(\w+)\s+.*?id="(\w+)"
破損せずに文字列として保存できないようです。
どうすれば表現を回避し、その完全性を維持できますか?
ありがとう
string pattern = @"<asp:(\w+)\s+.*?id=""(\w+)""";
この Regex.Escape() メソッドを使用します。
Regex.Escape("<asp:(\w+)\s+.*?id=""(\w+)""");