How would you extract date out of this text?
@“Monthly letter: Random text
2024-07-09
collapsed”
Text is varying but date would always be in the format yyyy-MM-dd.
How would you extract date out of this text?
@“Monthly letter: Random text
2024-07-09
collapsed”
Text is varying but date would always be in the format yyyy-MM-dd.
Hi @kaurM
Have you tried this activity?
Thank you!
Unfortunately, My studio version (2022.10.4) doesn’t let me update the UiPath.System.Activities package.
Regex for the value:
Assign Activity:
strDate =
System.Text.RegularExpressions.Regex.Match(yourStringVar,"\d{4}-\d{2}-\d{2}").Value
Parsing into datetime:
DateTime.ParseExact(strDate,"yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture)
System.Text.RegularExpressions.RegEx.Match(inputString,“\d\d\d\d-\d\d-\d\d”)
Hi @kaurM
Please try the below syntax:
Input = "Monthly letter: Random text
2024-07-09
collapsed"
Output = System.Text.RegularExpressions.Regex.Match(Input, "\d+\-\d+\-\d+").Value.Trim()
Regards
Thank you
Your solution worked
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.