mattp
(Mattp)
July 13, 2020, 4:03pm
1
Hi All, on the 4th line I am trying to extract where it says
date ‘Feb 22,2024’
the Time ‘3:00 pm’
the location ‘Room 42’
The number of attendees ‘7’ how do I do this from the text file.
I would like to have it as simple as possible;e.g trying to avoid regex expressions
1 Like
Krishna_C
(Krishna C)
July 13, 2020, 4:18pm
2
@mattp
Did you try with ‘Get text’ activity?
mattp:
Feb 22,2024
Hi @mattp ,
You can store that data in a variable and use regex to extract the info you wanted as below.
Steps:
Store the data in a variable.
Use the following regex to find the values for Date, Time, Location as
^Date:(.*)Time:(.*)Location(.*)$
You will get three groups from the above regex expression.
Date = RegExGroups(0).Groups(1).tostring.trim()
Time = RegExGroups(0).Groups(2).tostring.trim()
Location = RegExGroups(0).Groups(3).tostring.trim()
Kindly look into this if you want to know how to do the same with UiPath in the below thread.
Hi @sai_krishna_somisetty ,
Please find the RegEx and how to assign it to two variables as you have mentioned.
(.*)(?=\\)\\(.*)
It will give two groups as below in the screenshot
[image]
A = RegExGroups(0).Groups(1).tostring
B = RegExGroups(0).Groups(2).tostring
RegEx.xaml (5.9 KB)
I attached the XAML for your reference
[image]
Hope it will help, Mark as Solution if you find it useful.
Warm Regards,
Ranjith Udayakumar
bcorrea
(Bruno Correa)
July 13, 2020, 5:27pm
4
Without regex i would do like this:
varDate = text.Substring(text.IndexOf("Date: ")+ 6,((text.IndexOf("Time")- 4)-(text.IndexOf("Date: ")+ 6))).Trim
system
(system)
Closed
July 16, 2020, 5:27pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.