Text extraction from string

I have a long description text that I scrap from a website.
I want to extract some of the information and return it to a output variable.
Can anyone help/advice me on this ?

I highlighted the words that I want to extract in bold.

B) For Insert and Modify : Modify Information of Products
(Must check and verify)
Existing Products & Quantity & ID
(1) Jeans 75 J73820
(2) Shirts 10 S02932
(3) Bottoms 2 B0239
*Order ID (Customer Purchase): THK78183XL9102
*Item to check: Stock, Brand
*Before and after:

CURRENT

-----------------------------------------------------------------------------
Product ID : J73820
Quantity : 75
Title : Jeans
Brand: XXXX
-----------------------------------------------------------------------------
NEXT ACTION
Increase stock

TO BE

-----------------------------------------------------------------------------
Product ID : J73820
Quantity : 100
Title : Jeans
Brand: XXXX
-----------------------------------------------------------------------------
NEXT ACTION
Add 25 unit

*Attention: Product Manager
*Classification: N/A

C) For urgent product

Hello @NAJAA_BAZILAH ,

The scrapped text format remains same all the time or does it change?

Hi @Pradeep_Shiv , the template will remain the same. But the content like below will change, it can be up to 10-20 items.

Existing Products & Quantity & ID
(1) Jeans 75 J73820
(2) Shirts 10 S02932
(3) Bottoms 2 B0239

And the Before and after items also can be change if more products available. But the content like Product id, quantity, title brand will be fixed. And the word like CURRENT, TO BE also will be fixed

CURRENT

-----------------------------------------------------------------------------
Product ID : J73820
Quantity : 75
Title : Jeans
Brand: XXXX
-----------------------------------------------------------------------------
NEXT ACTION
Increase stock

TO BE

-----------------------------------------------------------------------------
Product ID : J73820
Quantity : 100
Title : Jeans
Brand: XXXX
-----------------------------------------------------------------------------
NEXT ACTION
Add 25 unit

Got It, you can use Matches activity to extract the info…

I’ll be sending you the patterns that is required to do so

This link to extract first block entries regex101: build, test, and debug regex
this one to extract second block entries regex101: build, test, and debug regex

Hi @Pradeep_Shiv , thank you for the answers that you provided.
It definitely help me in my workflow development and help me to understand how the regex works.

I will look at the example you provided for my different use case also.
Thank you so much :slight_smile:

1 Like

Hello @NAJAA_BAZILAH

Good to hear that it helped you.

Please take a moment to go throught his post to get a clear understanding how Regex works

MEGA Post - Regex

Regards,
Pradeep

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