2

I need to delete all text in html of body letter before one word from set of values ("Уважаемый", "Уважаемая", "Уважаемые"). I try to do like this:

LetterBody.Replace(Regex.Split(LetterBody, "(?=Уважаемый)|(?=Уважаемая)|(?=Уважаемые)")(0), "")

but using this method I lose almost all the formatting in the body of the email.

I programming in UiPath Studio using vb.net

V. Dedovec
  • 21
  • 2

1 Answers1

0

Try using Substring and IndexOf.

Would look something like:

var myParameter = "Уважаемый";    
var stuffINeed = LetterBody.Substring(LetterBody.IndexOf(myParameter) + myParameter.Length);

You could do this with the Invoke Code method or just use an Assign and replace the myParameter variable with the context you require. The above will remove everything before the myParameter keyword you choose.

If you want to remove everything after it then you would add after the above:

var endResult = stuffINeed.Substring(0, stuffINeed.IndexOf(myParameter))
craig157
  • 355
  • 1
  • 3
  • 18
  • Also lose almost all the formatting in the body of the email. I work with html code of body, not with the text. – V. Dedovec Jan 20 '22 at 14:59