Remove string occuring multiple times


#1

Hi All,

I need to remove the highlighted text/string from text file which is occurring multiple times.
Stating from “Page” to “www.abc.com”.

I tried using index of both and used remove option ,however it is deleting only the first part of the string where it is present,for other parts where the same string is present how to remove.

Any way i can remove in one go or iteration thru loop somehow.


#2

Dear,
You can use there replace
like
YourString.tostring.replace(“Enter your all string who you want to remove”," ")

Thanks & Regards
Bagish Ojha


#3

@bagishojha page “2” of 4 ,no is changing.


#4

please
show me your code or screenshot


#5

I’m using string.remove(string.IndexOf(“Page”),string.indexof(“page”)+200)

this is removing the string on its first occurrence,but not all the occurrence.


#6

Hi @prateekjain1992

Try this:
(?=Page).+?(?<=abc\.com$)","")

Click here to see it in action.

You can use Replace activity, but make sure the Single Line option is selected:
image


#7

hi @loginerror ,

thanks for the help,the regex is working fine when I am testing on regextester.

However in uipath it is not able to find,i have selected all three options in regexoption.

Can you help on this.


#8

@prateekjain1992

Indeed, the issue was with the $ character. It will work when you remove it, see example:
SimpleRegexTry.zip (1.9 KB)


#9

Thanks,it worked.


#10