Extract only specific data from notepad

Hi all,

How can I extract specific data from a Notepad? It’s a “.cs” file opened using notepad.
For eg:
I want to get the text “PRODUCT_29” from below line.
div class=“PRODOUCT_MATERIAL” style="visibility: hidden;"PRODUCT_29"div

It’s a long notepad file.
PRODOUCT_MATERIAL is always static but “PRODUCT_29” will be different.
I have tried to use the Get text activity. But I am unable to select the specific text.
Thanks.

Hi @Christin_John
U can use read text activity and store the data in notepad in string and then use regex to extract the data.

Hi @NIVED_NAMBIAR ,
Thanks for the reply. Can you please explain on reg ex part, how to do it. I have used read text activity and successfully store the data to a string.

Can u share the sample text and data u need to retrive from it ?

I want to get the text “PRODUCT_29” from below line.
div class=“PRODOUCT_MATERIAL” style=“visibility: hidden;” PRODUCT_29 "div

one thing need to know, always do u need to extract PRODUCT_29 or the text in that position ?

Hi @NIVED_NAMBIAR ,
I need the text in that position. and save it as a variable.

Hi @Christin_John
if you saved the data in a variable named as input_data after read text file activity, then use the assign activity

data = System.Text.RegularExpressions.Regex.Match(input_data,"(?<=hidden;\”\s).*(?=\")").Value.ToString

The data will contain the value that u need , that is PRODUCT_29 in the above case

Regards,
Nived N
Happy Automation

div class=“PRODUCT_MATERIAL” style=“visibility: hidden;”>PRODUCT_29</div

Can you please help me to write a reg ex for the above line, to extract PRODUCT_29

Thanks in advance

Hi @Christin_John
use this regex
(?<=\>).*(?=\<\/div)

Regards,
Nived N