Date Extraction from string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-10-22 04:46 PM
Please suggest ways to extract date in the mm/dd/yyyy format from below given strings
10/15/2022, 23:59:59 CEST
10/15/2022, 23:59:59
10/15/2022, 23:59
All the above 3 strings are of mm/dd/yyyy format
Below dates are of format dd.mm.yyyy
20.10.2022, 21:59:59 CEST
20.10.2022, 21:59:59
20.10.2022, 21:59
both the formats given, need to be converted to mm/dd/yyyy and only date needs to be extracted.
I have tried using Utility - Strings - Regex::Replace with patter "(\d{1,2})\.(\d{1,2})\.(\d{4})" and replacement "$2/$1/$3" but this does not help with the alphabets and slashes in the string.
------------------------------
Bhargava M R RPA Engineer
Associate Software Engineer
Mphasis
Asia/Kolkata
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-10-22 11:10 PM
The regular expression you provided only handles period (.) character but not forward slashes (/), hence I modified it a bit as shown below:
(?<Date>(\d{1,2})[\.\/]+(\d{1,2})[\.\/]+(\d{4}))
Test Result On Regex101:
To test the same, you can use either of the below two approaches apart from replace regex action as shown below:
Approach 1:
You can use the 'Extract Regex All Matches' action from the latest 'Utility - Strings' VBO at Digital Exchange and use the following regex expression:
Test Result On Object Studio:
Approach 2:
You can use the original action 'Extract Regex Matches' which is present from the prior versions of this VBO and make sure you pass the named values collection with the following schema:
The name values collection should have two columns called as, 'Name' and 'Value' with one row where the 'Name' column cell has the value as Date.
The regular expression pattern would be same as above and upon executing the action you should be able to get the result in the same collection as follows:
------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future
Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com
----------------------------------
------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
19-10-22 12:53 PM
------------------------------
Bhargava M R RPA Engineer
Associate Software Engineer
Mphasis
Asia/Kolkata
------------------------------
