How to extract particular Data

~DESCRIPTION: DATA~DOCUMENT NO.: 123

~INSTITUTIONS FOR INFORMATION & TECHNOLOGY ORIENTATION PROGRAMS:
~TPS#~123455~~Y1 21-2022
~PARTDATA#

Above mentioned one is sample data.

1.Here i want to extract (“~INSTITUTIONS FOR INFORMATION & TECHNOLOGY ORIENTATION PROGRAMS:”).
2.Then Document No is dynamic, Instead of this some other data also can come.
3.In some scenarios (“~TPS#~123455~~Y1 21-2022”),these data is not available only (“~PARTDATA#”).

Any one can you please help me to fix it.

Hi @Chippy_Kolot

Can you share us the input and output

Regards
Gokul

Hi @Chippy_Kolot - I am not quite sure I understand it. So, you want to extract all the 4 rows of data that you mentioned here

Hello @Chippy_Kolot for Document number extract
use regex expression

System.Text.RegularExpression.Regex.Match(Variable, "(?!DATA~DOCUMENT NO. :)\d+.(?=\s\n)").tostring.trim

You can get number alone Output= 123

@Chippy_Kolot try this to extract TPS dynamically

System.Text.RegularExpression.Regex.Match(Variable, "(?<=:\n).*").tostring.trim

image

image

~DESCRIPTION: DATA~DOCUMENT NO.: 123

~INSTITUTIONS FOR INFORMATION & TECHNOLOGY ORIENTATION PROGRAMS:
~TPS#~123455~~Y1 21-2022
~PARTDATA#

This is the input and the output should be
“~INSTITUTIONS FOR INFORMATION & TECHNOLOGY ORIENTATION PROGRAMS:”
Document No:123 it can be document no or some other words.
“DocumentNo:123” this is dynamic, instead of Document No,
Date ,Total anything can come

@Chippy_Kolot
Try this, If DESCRIPTION : is consatant

System.Text.RegularExpression.Regex.Match(Variable, "(?<=~DESCRIPTION:).*").tostring.trim

image
image

System.Text.RegularExpression.Regex.Match(Variable, "~INSTITUTIONS FOR INFORMATION & TECHNOLOGY ORIENTATION PROGRAMS:").tostring.trim