i am building up a proxy in csharp and one of my tasks is to find emails inside
an http header, problem is that inside the data that i get i receive %40 instead of
@, could anyone please tell me how can i detect emails when the @ inside the mail address is being replaced with %40?
here is my code for getting email addresses inside a given string (with @ and not %40 instead)
Code:
string regexPattern = @"[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}";
Regex regex = new Regex(regexPattern);
MatchCollection matches = regex.Matches(this._context.Request.Headers[i]);
foreach (Match match in regex.Matches(this._context.Request.Headers[i]))
{// any email address should be printed
Console.WriteLine(match.Value);
}
URL decode your data before running it through the regex:
Or: