using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=Set-Cookie: __RequestVerificationToken=).{108}";
string input = @"HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Set-Cookie: __RequestVerificationToken=6JBpdPLoWg2ON0CbCTTCffsZZsCU_rRGlmarVTRfg4Gu1_6FEqpgd_jcLbN_mBWdXJjCeYw6DQ3nxd8hABsNTpRWJALapk9KUZhu6jGkh0I1; path=/; HttpOnly
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
strict-transport-security: max-age=60; includeSubDomains
referrer-policy: strict-origin-when-cross-origin
Set-Cookie: httpOnly
X-Content-Security-Policy: script-src 'self' https://fonts.gstatic.com
Date: Wed, 12 Feb 2020 15:46:34 GMT
Content-Length: 3124";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx