String Manipulation on Outlook mail body

I have posted this earlier and thanks to those who helped
But unfortunately, when i read the Email in UiPath, I lose its formatting, so i may need a new Regex.

The actual format was

image

But I am getting this format, when I read the Email message and write it inside a log message

New format

AIRCRAFT REG. N702A (H-900)
Origin
Departure
Destination
OEDF
0530Z
OERK
OERK
1130Z
OEDF

AIRCRAFT REG. N805XA (B-738)
Origin
Departure
Destination
OESB
0805Z
OERK
OERK
1010Z
OEJN
OEJN
1240Z
OESB


So basically it has treated every space as a new line.
I want to extract AirCraft Reg. ,Orign, Departure and Destination values

Note: There can be many AirCrafts Reg. No with their details in the same manner,

Basically then i have to enter those extracted values to the form
Thanks

HI @Sami_Rajput

Please use the below regex

For Aircraft Reg use below regex

System.Text.RegularExpressons.Regex.Match(Input.ToString,"((AIRCRAFT\s+REG.?\s+)(.*))").Value

For Origin use below regex

System.Text.RegularExpressons.Regex.Match(Input.ToString,"([A-Z]+)(?=\s+\d+[A-Z]\s+[A-Z]+)").Value

For Depature use below regex

System.Text.RegularExpressons.Regex.Match(Input.ToString,"(?<=[A-Z]+\s+)\d+[A-Z](?=\s+[A-Z]+)").Value

For Destination use below regex

System.Text.RegularExpressons.Regex.Match(Input.ToString,"(?<=[A-Z]+\s+\d+[A-Z]\s+)([A-Z]+)").Value

Regards

thanks
@vrdabberu can you tell me how you have made them

@Sami_Rajput

I have seen that the origin and destination have been separated by departure so based on that I have extracted the data.

If you find the solution please do mark as solution to close the loop

Regards

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