abdel
(Robot usa)
January 29, 2020, 9:00am
1
Hello Guys,
few days ago a had got a regex formula to get a telephone number from a string it works in uipath but when i used it in a c# code:
string labphone = System.Text.RegularExpressions.Regex.Match(item, @“(?<=l:|l :).[0-9\s0-9\W]”).Value;
it did not work, also when testing the regex alone:
can you provide the sample and string ?
abdel
(Robot usa)
January 29, 2020, 9:06am
3
tél : 01 88 33 32 88 fax : 01 49 41 21 15 Dr J. FRRR Dr P. ASSS
sarathi125
(Parthasarathi)
January 29, 2020, 9:10am
4
@abdel ,
Try with this regex expression, I hope the “fax” text will there always.
(?<=tél :|tél:\s).*?(?=fax)
abdel
(Robot usa)
January 29, 2020, 9:32am
6
could you give me the link to the regex tester?
also i had tryed in the c#:
System.Text.RegularExpressions.Regex.Match(item, @“(?<=”+row[8]+“:|”+row[0]+" :).[0-9\s0-9\W]").Value;
but there is an error: unrecognized escape sequence
arivu96
(Arivazhagan A)
January 29, 2020, 9:34am
7
HI @abdel ,
please refer below URL for testing purpose
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Regards,
Arivu
sarathi125
(Parthasarathi)
January 29, 2020, 9:35am
9
abdel:
also i had tryed in the c#:
System.Text.RegularExpressions.Regex.Match(item, @“(?<=”+row[8]+“:|”+row[0]+" :).[0-9\s0-9\W]").Value;
You haven’t closed the first “(” braces correctly… we can see two open “(” but only one “)”.
abdel
(Robot usa)
January 29, 2020, 11:40am
10
hello,
i know that it is not a c# forim but i got the Following error:
: 'Impossible to cast a ‘System.DBNull’ object in ‘System.String’ type
when running the code:
static void Main(string args)
{
DataTable dtexcel = new DataTable();
Console.WriteLine(“Hello world”);
string PathFolder = “---------” ;
foreach (string file in Directory.EnumerateFiles(PathFolder, “*.txt”))
{
string labphone= null;
string labname = null;
string Analysisdate= null;
dtexcel = exceldata("-------.xlsx");
string[] splitted;
List<string> List = new List<string>();
string text = System.IO.File.ReadAllText(file);
splitted = text.Split('\r');
foreach (string item in splitted)
{
foreach (DataRow row in dtexcel.Rows)
{
if (item.Contains((string)row[8]))
{
Console.WriteLine("row" + row[8]);
labphone = System.Text.RegularExpressions.Regex.Match(item, @"(?<=l:|l :).[0-9\s0-9\W]*").Value;
List.Add(labphone);
}
}
}
string extractedlabphone = List.First();
Console.WriteLine("labphone" + extractedlabphone);
//Fin d'extraction de télèphone
foreach (string item in splitted)
{
foreach (DataRow row in dtexcel.Rows)
{
Console.WriteLine("Row(0)" + row[0]);
if (item.Contains((string)row[0]))
{
labname = item;
}
}
}
Console.WriteLine("labname" +labname);
Console.WriteLine("Press any key to exit.");
System.Console.ReadKey();
}
}
You should try this amazing service GoogleFaxFree. This will help you how to send gmail fax free basically Google Fax Free offers an amazing option . You must try. All the best!