Fetching date from email msg

In a mail body some text will be therer with the date
i have to fetch the date alone from the mail body
how can i do it ?
for example:
we can have : 19/11/1997 some text over here
next: some text over here 19/11/1997

like above example how can i do it?

@Jebarohith19 If Date is always in that format, we can use regex to get the Date, The regex you would need to use is in this link:

i have no idea how to use regex in uipath .
should i use regex expression in assign activity?

1 Like

@Jebarohith19 Do you want to Store that Date value in a Variable ?

i will first fetch the body of mail message in a variable which will contain the above format which i mentioned(text with date or date with text starting)
so mailmessage will be in a variable by using assign activity.
then what to do?

1 Like

@Jebarohith19 Use An Assign Activity to a String Variable like this :
strDate = System.Text.RegularExpressions.Regex.Matches(mailBodyVar,“\d{2}\/\d{2}\/\d{4}”)(0).Value.ToString

2 Likes

so this regex is for date starting with text?
so then for text starting first what should i change?

1 Like

@Jebarohith19 For both :sweat_smile: Please Check if it works

1 Like

okay let me check and keep it posted

1 Like

it shows cannot assign string to generic value

1 Like

@Jebarohith19 Change your variable to String Type

it is in string datatype only\

1 Like

@Jebarohith19 Can you share your xaml or Show the Screenshot of the Variables Section and Assign that you have used?

i cleared the errors and it worked supercool
thanks @supermanPunch

1 Like

@Jebarohith19 Good Going :smiley:

u r doing a great work to help others .thanks

1 Like

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