Getting a paragraph for a single word match

So, I have used read text from the file (word) and have an output as a string. Now, I want to obtain match a word in this string. If it matches, I want to capture the whole paragraph. Is there a way to do this?

Example - Below mentioned is a paragraph -

Mr Kilicdaroglu, who has walked around 20km a day for the past three weeks, condemns the coup attempt but says the purges and emergency rule by Mr Erdogan constitute a “second coup”.
He told crowds at the rally: "We marched for justice, we marched for the rights of the oppressed. We marched for the MPs in jail. We marched for the arrested journalists.
“We marched for the university academics dismissed from their jobs. We marched because the judiciary is under a political monopoly.”

And I want to check if this has word - journalists. If it does, I want to capture the whole of the paragrapth.

Atypical ideas will also be appreciated

This is one idea.

Assuming the paragraphs are spaced by 2 newlines, then you can split the entire text by that so the paragraphs are grouped.

For example,
arrayVariable[type String] = text.Split({Environment.NewLine+Environment.NewLine},StringSplitOptions.None)

Then a “For Each” of type String
Foreach paragraph in arrayVariable

So it will loop through each paragraph.
Then finally, you can use an “If” activity to see if the paragraph contains the string.

If paragraph.Contains(“journalists”) then
Write Line paragraph


Thanks for your help (sorry for writing in late :slight_smile: ). it did work and I was able to separate it. Though I had to play around a bit, but idea helped.


Can you please share the eample xaml file. i am finding it difficult to build this logic

Thanks in advance

HI @ClaytonM,

Can you please share a sample xaml files?? if you have !! i am having trouble trying to create the above mentioned worklfow.

Thanks in advance.

Thanks @ClaytonM,

I did that but however i am unable to split the paragraph & loop throught it.Hence i have asked a sample work flow. Can you help me out on this??