How to extract words in different lines (Regex)?

Hello!

With the anchor Leg 1, I want to get the word “SIN” and “DXB” separately. How do I do this with regex?

Leg 1 of Singapore (SIN) toDubai (DXB) Operated by Emirates (equipment owner - Emirales) Flight Check-in: at Departure 467 10Dec2021 10Dec2021 15:30 18:30 Departing SIN, Changi Airport Economy Terminal 1 Saver Seat Status Arrival Confirmed 10Dec2021 20:40 Arriving DXB, Dubai International Terminal 3

Hi @helpplease

1.Use the expression \(([A-Z]{3})) in the matches activity
2.Use For each to iterate through collection

Hope it helps!!

Hi @helpplease

For SIN

For DXB

I hope it helps!!

I’ve tried these two, but I want to use “Leg 1” as the anchor because the text I send for help is the first half of the full text I have, the second half of the text is “Leg 2”. So if used those two expressions I will have two XXX highlighted at the same time.

@helpplease

Use this expression to get SIN with the help of Leg1
Leg 1.*?\((\w{3})\)

Use this expression to get DXB with the help of Leg1
Leg 1.*\(([A-Z]{3})\)

Hope it helps!!

1 Like

@helpplease

For SIN

(?<=Leg 1\s\w+\s\w+\s\()\w+

For DXB

(?<=Leg 1\s\w+\s\w+\s\(\w+\)\s\w+\s\()\w+

@helpplease

Try in Studio

@helpplease

SIN Output

DXB Output

1 Like

@helpplease

Remove > Symbol at starting position and try

hi @helpplease

please use the below syntax and the workflow to get the SIN and DBX

Hope it works !!

1 Like

I can see SIN in the message box, but for DXB, there is nothing in the message box.

@helpplease
Can you show your code

It’s okay, I managed to get both after running the sequence a few times. Thank you for the help!!

1 Like

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