How to extract a small text(like value of Date) from an image/UI element having a large amount of text?

Hi UIPathians,

I have a UI Element which has a lot of text(a couch doc to be specific).
Following is an extract of text that it has:
{
“CURRENT_VERSION”: “3.0”,
“_id”: “995ab0796246fe120aba5183ff377e54”,
“_rev”: “5-e6ee0d4afd2f8857847e2cc44df208cf”,
“analytics_enabled”: true,
“announcements_seen”: ,
“assigned_location_ids”: ,
“attempt_date”: null,
“atypical_user”: false,
“base_doc”: “CouchUser”,
“created_on”: “2018-10-23T12:09:30.363371Z”,
“date_joined”: “2018-10-23T12:09:30.131028Z”,
::
::
}

What I want is extract only the value of date_joined, ie, “2018-10-23T12:09:30.131028Z”
But somehow am not able to get it.
I have tried Screen Scraping/get text but I get complete text of the UI element instead of only the desired date value.
Following data extraction is also not helping me:

I’ve tried searching for other solutions as well but none has worked out yet.
Any help in this direction is greatly appreciated.
Thanks!

PS: Let me know if any other input from me helps.

It is a string that you have as output?

@Akanksha_Varshney you can use below regex

You mean datatype of the output variable(matchValue in the screenshot)?
Its IEnumerable if am understanding your question correctly.

I meant the text what you are getting

this one is a plain string?

Thanks,
Prankur

Thanks @indra for the response!
Will try it and let you know.

Hi @PrankurJoshi,

It is not exactly a plain string.
The whole text is embedded in a UI Element and when I try to ‘copy’ it, the whole string gets copied instead of just the date value.

Thanks!

Hey @indra !
Am already using the following regex “(?<=” + labelBefore + ")(.?)(?=" + labelAfter + “)” which I believe is same as the one regex101.com is providing (?<=“date_joined”:).(?=,)
:expressionless:

@Akanksha_Varshney Clarify one thing from the string you need only “date_joined” value ie “2018-10-23T12:09:30.131028Z” right know?

Correct @indra!

@Akanksha_Varshney

the string looks like Json.

So you can try like this also.
Use Deserialise Json and store the Result as Jobj the type should be Jobject

strJoiningDate=Jobj(“date_joined”).ToString

Regards,
Mahesh

@Akanksha_Varshney Here you can have the result

Main.xaml (7.6 KB)

Your solution worked like magic!
Thank you so much @indra :slight_smile:

1 Like

Hey, Thanks for the response @MAHESH1 but I did not get a chance to try it :expressionless:

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