How to replace multiple occurrences of a character with just one instance of the same character

studio
variable

#1

Hello,
I am trying to replace multiple instances of a character from a string with just one instance of the same character.
eg: input string - “ABC<EFG<<HIJK<<<LMNO<<<<<<<<<<<<P”
output string - “ABC<EFG<HIJK<LMNO<P”


#2

Please check with InStr function and condition of “<<” each time of the string.
if it get pass then replace “<<” with “<” and loop until get clear all “<<” characters in parent string.
Replace.xaml (9.7 KB)

Hope my inputs are useful


#3

@jamnanin
See this post it might help you.

Replace the Pattern by "<{2,}"

Regards,
Mahesh


#4

I am getting an error reading the activity


#5

You need Microsoft.Activities.Extentions package.
else
just use Replace function in assign activity.


#6


i have it installed


#7

image
image


#8

Regex.Replace(aa, “<{2,}”, “<”)

this worked just fine. thanks for the help


#9

cant find it in the dropdown of microsoft activities too