I am trying to use the following regex in c#
<asp:(\w+)\s+.*?id="(\w+)"
I cannot seem to store it as a string without corrupting it.
How can I escape the expression and maintain its integrity?
Thanks
I am trying to use the following regex in c#
<asp:(\w+)\s+.*?id="(\w+)"
I cannot seem to store it as a string without corrupting it.
How can I escape the expression and maintain its integrity?
Thanks
string pattern = @"<asp:(\w+)\s+.*?id=""(\w+)""";
Use this Regex.Escape() method.
Regex.Escape("<asp:(\w+)\s+.*?id=""(\w+)""");