Parsing or working with Regex to extract Specific Data

I have Annual Leave (Start Date - End Date): Name Surname data format in 1 column (Column name is ToDoSubjectline) combined.
I want to extract Annual Leave as a Permission Type. It can be Annual Leave, Birthday Leave, On Duty etc. but it always 2 digit.
How can i extract Permission Type, Start Date and End Date in a different variables?

I’ve already tried as

Assign | Permission Type = in_TransactionItem.SpecificContent(“ToDoSubjectLine”).ToString().Split(" "c)(0)
But it gives only Annual.

*Assign | StartDate = in_TransactionItem.SpecificContent(“ToDoSubjectLine”).ToString().Split(" “c)(1).TrimStart(”(“c).TrimEnd(”-"c) it gives Leave *

Assign | EndDate = in_TransactionItem.SpecificContent(“ToDoSubjectLine”).ToString().Split(" “c)(2).TrimEnd(”)"c) it gives Start Date not End Date.

Thank you in advance.

Can u send the example data for reference

@Dwightschrutee
to get annual leave need to take 0 & 1 position both…
Ex:

in_TransactionItem.SpecificContent(“ToDoSubjectLine”).ToString().Split(" “c)(0)+” " + in_TransactionItem.SpecificContent(“ToDoSubjectLine”).ToString().Split(" "c)(1)

try this you we get annual leave
Firstly assign that column to a variable then it will be easy to split and assign to required variables

ToDoSubjectLine=“BirthDay Leave (27/11/2023-30/11/2023)”

StartDate=system.text.regularexpression.regex.match(ToDoSubjectLine,“(?<=[(]).*(?=[-])”).value

EndDate=system.text.regularexpression.regex.match(ToDoSubjectLine,“(?<=[-]).*(?=[)])”).value

Cheers!!

these expressions were solved my problem, thanks a million

1 Like

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