I need to get the amounts of different form as well, currently extracting them using various regex and then combining. As you mentioned about the date, is there something we can do for amount?
Create an array variable and assign following values into it
{“dd-MM-yyyy”,“dd/MM/yyyy”,“dd/MM/yy”,“dd.MM.yy”,“dd.MM.yyyy”}
DateTime.ParseExact(row(0).ToString, arr_DateFormat, new CultureInfo(“en-US”), DateTimeStyles.None).ToString(“dd-MM-yyyy”)
above method to convert date into a single format in comes through in the various format
to use above method you need to add following namespace to uipath otherwise it wont recognize culture and style info
Thanks @SamanGuruge for providing the solution for the conversion task.
But I do not have the list of dates already. I need to extract the dates from a string and that string can contain date in any format mentioned above in my first post. Can you suggest anything for extract all the dates from the string?
Currently I am using different regex for the different type of dates. But can we have more generic regex to extract dates?
you have list of date pattern so that you can include in the array and parse that date pattern and your date value into Exactparse method and convert it into a single format
Sorry, I’m afraid I didn’t get the parse stuff understood correctly.
Can you please have a look at the project attached. The one sample Input file has certain dates in all different formats. I need to extract that and then convert into a standard form.
It is extracting “12.12.45” as the original text in another sample file contains “12.45.55.6.5”
and also extracting “52 EUR 34” as the input contains “124 52 EUR 34 56 EUR”
I will have a try catch and if the error is “Input not a valid date format” than I will delete that item from Match Result. Just want to confirm, any other solution to this?
It is not accepting the months Mai and Mars but not the other ones like, 13 Avril 2020, 9 septembre 2020. can this be added in the match regex of the code?
I have been using this regex extract this type of date : “(0[1-9]|[12][0-9]|3[01])\s(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)\s20\d\d\b”