Can dates be recognised?

activities

#21

https://forum.uipath.com/t/4-rpa-challenge-json-parsing/


#22

I tried something similar as above. However, the quantity isn’t showing up. even after i validated with it like 3 times. anything i missed out?
{
“_text”: “(Daily File) Jun 2018 119 GB(s)”,
“entities”: {
“datetime”: [
{
“confidence”: 0.946105,
“values”: [
{
“value”: “2018-06-01T15:00:00+08:00”,
“grain”: “month”,
“type”: “value”
}
],
“value”: “2018-06-01T15:00:00+08:00”,
“grain”: “month”,
“type”: “value”
}
]
},
“msg_id”: “0AHxGnqRzv5unStVl”


#23

Guys,

It seems here you are trying to use a sledgehammer to crack a nut.

I’m not sure why the use of wit.ai is required (as interesting as it is). It seems that the format is pretty consistent e.g. (Daily File) MMM 2018 therefore some basic string manipulation and/or regex should do the trick here.

RD


#24

I did try regex.


#25

Hi @sangasangasanga

Try this one instead:
(?<=2018 )\d+

It will find all numbers after 2018. It is very basic, but can be improved to take more conditions into account.

The full expression that returns a String with your numbers looks like this:
System.Text.RegularExpressions.Regex.Match("(New Paper) Aug 2018 119 KG(s)", "(?<=2018 )\d+").ToString

See a slightly improved example here.


#26

@loginerror
I am getting this texts to a datatable. Thus, Is there any function where if there nothing behind 2018, just add space?


#27

Could you specify what the issue is? I think something is missing in your last post.

If the problem is to not be able to match something, you can extend the Regex to include more possibilities, see here.


#28

Basically, this text is (New Paper) Aug 2018 119 KG(s) is in an array of strings. I am seperating each row into a column. Either 01 Jun 2018 to 30 Jun 2018 or (New Paper) Aug 2018 119 KG(s) will be in the array. I just want to get the value after 2018 and put it into another column. If there is nothing after 2018, add a space


#29

In the case of string
01 Jun 2018 to 30 Jun 2018
regex will not find anything, so you could base your workflow on the empty match (IF match is empty, then do space, otherwise the found number)