Removing text between two fixed String in uipath

Hi everyone

I was wondering if it is possible to remove text between two fixed words.

Suppose i have input string as

str_input = Bank is my favorite place Opening Balance

i want to remove the text between Bank and Opening Balance.

my final result will be: is my favorite place.

Please help.

1 Like

Hey @Raghavendra_Raghu

Hope you are doing well

you can use matches activity for that pass this pattern you’ll get the expected output
(?<=Bank\s).*(?=Opening Balance)

cheers
@Raghavendra_Raghu

1 Like

Sorry,

i have input string as

str_input = Bank is my favorite place Opening Balance

i want to remove the text between Bank and Opening Balance…

This is extracting the text, but i want to remove the text between two string.

@Raghavendra_Raghu - pls try below -

System.Text.RegularExpressions.Regex.Replace(str_input,”(?<=Bank).*(?=Opening Balance)”,””,RegexOptions.IgnorePatternWhitespace)

1 Like

ok i will try this.

It is extracting everything.

pls share input and expected output string…

Kindly find the attached screenshot

try this -
input: “Bank is my favorite place Opening Balance”
System.Text.RegularExpressions.Regex.Replace(str_input,“(?<=Bank).*(?=Opening Balance)”,“”)
output: Bank Opening Balance

2 Likes

Working thank you

1 Like

Suppose if my string becomes like this in the new line as

str_input: Bank is my favorite spot in
Opening Balance that it

i wanted to delete the string between Bank and Opening Balance(here new line).

1 Like

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