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

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”

1 Like

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

@jamnanin
See this post it might help you.

Replace the Pattern by "<{2,}"

Regards,
Mahesh

2 Likes

I am getting an error reading the activity

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


i have it installed

image
image

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

this worked just fine. thanks for the help

cant find it in the dropdown of microsoft activities too