I am trying to extract a quoted text from an html response. However when i use regular expression to match the data i get the error message “Unrecognized escape sequence”.
The code is pasted below. Am i missing something basic here?
static private string ParseText2GetLink(string response)
{
Match match = Regex.Match( response, @"("[^"]*\.csv")" );
string key = null;
// Here we check the Match instance.
if (match.Success)
{
// Finally, we get the Group value and display it.
key = match.Groups[1].Value;
Console.WriteLine(key);
}
return key;
}
To include a double quotation mark in a
@""string, you have to double it:Or you could use a normal string:
(Note that now you have to escape the backslash.)