I hope someone can assist here. I have tried to get things working but my understanding of regex, even with the help of regex101.com is limited.
I have a process that processes a mailbox to create tasks. That part works fine, but my intention is to have an automation pick up that task and create a worklog for a user automatically. I'm not in control of the body of the email (and thus the description of the task), but it is consistent. The body of the email (or the bit I care about) looks like this:
Staff Member: Tim Foster
Department: Framework
Staff Member: Tim Foster
Leave Type: Annual Leave
From: Monday, 15-Aug-22
To: Monday, 15-Aug-22
[1] [2]
Days: 1
Working DAYS: 1
Allowance DAYS: 1
Free Days: 0
Non Working Days: 0
Leave Notes:
I have managed to get my regex to determine the name, From, To and working days, so I'm close. However, the fromdate variable that I have set, contains "Monday, 15-Aug-22" and I am struggling to convert this to a date.
My variable is set with {{issue.description.match("(?<=From\: )([^, ]+), (.*)")}}
I tried {{issue.description.match("(?<=From\: )([^, ]+), (.*)").toDate}} and I tried {{FromDate.toDate}} as a separate step, but everything I try seems to null the variable. I thought maybe I need to remove the Monday, but because this comes from an email there is another From: in the body and my regex knowledge isn't good enough to work out how to ignore the day and comma.
My ultimate aim is to have it as a date so I can add the working days to it in a loop and create a work log for each day of holiday.
I was quite proud of myself having got the values out in the first place, but now I'm stuck getting over this final hurdle.
Could someone point me in the right direction please?