Output Contains my keyword

EX: This is my output “Hi everyone, I hope u r doing good.
Happy Automation.”
If the above text contains “hope”, I want to get that full sentence.
I hope u clear, Thanks in advance.

1 Like

Hi,

How about the following?

img20211111-a

Or do you need extract a sentence which has “hope”? If so, can you share expected result?

Regards,

Hi @raja_ias

I believe i have understood your requirements. The Regex pattern I have used is:
[^.]*hope[^.]*

Sample workflow:
Main.xaml (7.3 KB)

Output pane:
image

Further to Yoichi’s post the expected output would be benefit those looking to assist :slight_smile:

Hopefully this helps you.

Hi

Hope you are getting that output in a variable named stroutput

Sometimes the word hope can come like HOPE or Hope or hope

In that case use this one single assign activity to validate and get the sentence

Stroutput = IF(strinput.ToString.ToUpper.Contains(“HOPE”), strinput.ToString, String.Empty)

Here stroutput is a string variable
We are using a IF condition in a assign activity itself
Where the structure is like this

IF(condition, True means this expression , False means this expression )

So here if it’s sentence has Hope in any format then it will give the complete sentence or it will give a empty value to the output variable

Hope this would help you resolve this issue

Cheers @raja_ias

@Palaniyappan It works fine…But it gives full sentence, i want till next line

@Steven_McKeering , What if my sentence does not contain (.)

Hey

Some more samples would be good :sweat_smile:

We need to determine a pattern from multiple samples to create a robust working Regex Pattern.

Take a look at this pattern if you want until the next line.

Regex Pattern:
[^\.]*hope[^\n]*

Thanks @Steven_McKeering

1 Like

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