How to remove words or lines before particular keyword if exist

I want to remove all the words or lines if any found before Transaction Reference Date

Note: data can be anything before Transaction Reference Date.
E.g.
Input
"Data arrived
30/2/2021

Transaction Reference Date- 7/2/2021 for user xyz.

Reference package information- xbyysss"

Output:

"Transaction Reference Date- 7/2/2021 for user xyz.

Reference package information- xbyysss"

Hi @Mansi_Mhatre

Try below code

strOutput= strInput.Substring(strInput.IndexOf(“Transaction”))

Hope the above code will work for you

Thanks

1 Like

Hi @Mansi_Mhatre

You can try with Regex expression.

Can you send the Input text in preservative format

Regards
Gokul

Hi @Mansi_Mhatre

You can use following Regex:

System.Text.RegularExpressions.Regex.Match(Input_str,"(?=Transaction)[\s\S]*").Value.Trim
Hope this will work for you

Regards,
Vinit M

Hi @Mansi_Mhatre

Use Assign activity

LHS - Create an Variable
RHS - System.Text.RegularExpressions.Regex.Match(“Input String”,“(?<=\d{4})[\S\s]*”).Tostring.Trim

Refer the screenshot
image

Hope it will works

Regards
Gokul

Kindly mark the appropriate post as solved, If you query is resolved @Mansi_Mhatre

So, that it will help others to

Regards
Gokul

Thank you so much. It worked for me.