1protected string obfuscate(string input)
2{
3
4 string email = string.Empty;
5
6 MatchCollection matches = Regex.Matches(input, @"[a-zA-Z]+[a-zA-Z0-9]*[\.|\-|_]?[a-zA-Z0-9]+@([a-zA-Z]+[a-zA-Z0-9]*[\.|\-|_]?[a-zA-Z]+[a-zA-Z0-9]*[a-zA-Z0-9]+){1,4}\.[a-zA-Z]{2,4}", RegexOptions.Singleline | RegexOptions.IgnoreCase);
7
8 foreach (Match match in matches)
9 {
10 email = string.Empty;
11 Array matcharray = match.Value.ToCharArray();
12 foreach (char letter in matcharray)
13 {
14 email += "" + Convert.ToInt32(letter).ToString() + ";";
15 }
16
17 input = input.Substring(0, match.Index)+email+input.Substring((match.Index+match.Length));
18 }
19 return input;
20}