-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilters.cs
More file actions
42 lines (37 loc) · 1.02 KB
/
Filters.cs
File metadata and controls
42 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Text.RegularExpressions;
namespace RecolectorEmail
{
public static class Filters
{
public static string GetPhoneNumber(string text)
{
string found = "";
while (text.Contains(" "))
{
text = text.Replace(" ", "");
}
while (text.Contains("-"))
{
text = text.Replace("-", "");
}
MatchCollection mc = Regex.Matches(text, @"(\d{9,11})");
foreach (Match m in mc)
{
switch (m.Value[0])
{
case '9':
case '6':
case '7':
found = m.Value;
break;
default:
if (found == "")
found = m.Value;
break;
}
}
return found;
}
}
}