Take certain text from line

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

@mattp
Did you try with ‘Get text’ activity?

Hi @mattp,

You can store that data in a variable and use regex to extract the info you wanted as below.

Steps:

  1. Store the data in a variable.

  2. Use the following regex to find the values for Date, Time, Location as

    ^Date:(.*)Time:(.*)Location(.*)$

  3. 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.

Warm Regards,
Ranjith Udayakumar

Without regex i would do like this:
varDate = text.Substring(text.IndexOf("Date: ")+ 6,((text.IndexOf("Time")- 4)-(text.IndexOf("Date: ")+ 6))).Trim

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.