Extract text based on your input search

can anyone tell me, how can i extract the whole sentence from a text file based on my input search. So i am using a getfull text activity of screen scraping and capturing all the data of my web page and storing it a in string variable (output of getfulltext acitivity). Now, i am having a variable called arrayVar = {“A”,“B”}. So basically, i need to search based on this input . Now i am using a loop and using regex in if activity , i am checking whether these arrayVar item are available in my string test. i am able to find the same as well.
Now this is what i want to do, once i found the word i need to extract the string sentence if present . So suppose if my string contains
my name is
Anshuman pathak
i am from Delhi.
and if my arrayVar contains anshuman, then i need to fetch Anshuman Pathak

Hi, If you want extract data from your String You can split text by New Line like this:

arr_string = yourTextString.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)

For each item in arr_String you seach result array by array:

and you output the index of element in array

Then when you have index simply use:


Main.xaml (29.1 KB)

hi this is what i am doing, in your logic what is in_arr? attaching the my main xaml

in_array = arr_string

Because the search module (“Find”) is as a separate workflow. I’m reusing this module while searching for text.

I pass the arguments in and out to the module.

From you Main.xaml Correct what is red.

Main.xaml (33.7 KB)
i actually checked that before as well, but what i am not getting is to how to print the that whole word/sentence .as i am looping in arrayvariable which we just created. now how will i print the sentence from the arrayvariable if it findes the match

Before you put text to array you used:

outputText = Regex.Replace(stringText, “[^a-z A-Z 0-9]”, “”)

and You removed anything that is not a letter or a number, including New Lines.
Remove unwanted characters after matching.

its not working

Based on what you have uploaded, build a test workflow with the input text set to hardcode. And check the output of your text step by step.

If you still have issues, please share this workflow so that We can test what you are up to.