Get the text which is present between 2 strings

from scrapping the screen i am getting the following string:

file transfer from sftp server complete

Creating Material Master

All mandatory columns present.

Data Lookup

ERSDA,PSTAT,MEINS,BMATN not present in MARA

BWTTY,MMSTA,MAABC,KZKRI,DISPR,DISMM not present in MARC

LONG TEXT not present in STXL

POSNR,POSTP,MEINS,MENGE,POTX1,POTX2 not present in STPO

ATFLV,ATAWE,ATFLB,ATAW1 not present in AUSP

Creating Plant Master

All mandatory columns present.

Creating Classification Master

from this string i want:

All mandatory columns present.

Data Lookup

ERSDA,PSTAT,MEINS,BMATN not present in MARA

BWTTY,MMSTA,MAABC,KZKRI,DISPR,DISMM not present in MARC

LONG TEXT not present in STXL

POSNR,POSTP,MEINS,MENGE,POTX1,POTX2 not present in STPO

ATFLV,ATAWE,ATFLB,ATAW1 not present in AUSP

that means i want everything that is present between “Creating Material Master” and “Creating Plant Master”

so how should i do it?

1 Like

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Creating Material Master)[\s\S]*?(?=Creating Plant Master)").Value

Regards,

should i use it in assign or how should i use it?

Hi,

yes, we can use it in Assign activity like

extractString = System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Creating Material Master)[\s\S]*?(?=Creating Plant Master)").Value

Regards,

Hello @Aishwarya_Bhargava ,

you can also try this pattern (?<=Creating Material Master)(.|\n)*(?=Creating Plant Master)

Cheers

it worked thankyou :slight_smile:

1 Like

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