// Use regular expressions to match the different parts
Assign: match = System.Text.RegularExpressions.Regex.Match(inputString, “^Factura(\d+)(\d{8})(\d{8})(\d+).xlsx$”)
However I am getting this error when assigning the first date:
Can not assign ‘DateTime.ParseExact(match.Groups(2).Value, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture).ToString(“yyyyMMdd”)’ to ‘MyString’.
But I guess I can simply do Assign date1: match.Groups(2).Value and the same with the next date, right?
With your Regular Expression the last “code” or “version” has to be 1 digit, can you think of any way to make it dynamic?
I can simply do Assign date1: match.Groups(2).Value-Yes,You are correct and datatype is string
the last “code” or “version” has to be 1 digit, can you think of any way to make it dynamic?
2023 is too strict, I guess I could do (20\d{6})(20\d{6}) and use the “20” as starter for the year but, if the first code (the “500047”), contains a “20” followed by 6 digits then everything gets messed up
When we got 2 items - take it
for all items count > 2 and even ( X Mod 2 = 0 ) - take the middle ones ( partly right )
For all items count Mod 2 = 1 - we cannot predict, sort it out for clearing steps
use index for the _ insertion
It is absolute not perfect, but we want to support your approach of quality and checking for the side effects like:
no problem, with some distance we come to the conclusion:
when matches count = 2 we can rely
when matches count > 2 we do have risks
when match count > 2 and even like 2,4,6, -
we can pick up the middle ones (but also can be not correct)
when match count > 2 and odd like 3,5,7, -
we cannot decide as it can be ( for match count 3) CodeLikeDate_Date1_Date2_Code Or Code_Date1_Date2_CodeLikeDate