I am working in UiPath Studio, this uses VB.NET . So i have a word document and i have to replace some texts. I have for example a new line than some text than a new line… and sometimes i need to delete that “some text” and i am ending up having a word document with like 3 new lines between some texts, so i have multiple texts and multimple lines… so this is approximetly what it’s look like:
Some text1
Some text2
Some text3
Some text4
.......
And then if i replace Some text2 with String.Empty i am getting this:
Some text1
\n
\n
\n
Some text3
Some text4
.......
And i want to look like this:
Some text1
Some text3
Some text4
.......
I have multiple "Some text" so i need a general method to work.
Imagine that \n is not there, it's a new line. I just used it because if i write multiple new lines stackoverflow deletes them.
I tried everything, i tried like 20 diffrent methods and nothing worked, it's gotta be something that works.
I tried a lot of these things and other alternatives:
System.Text.RegularExpressions.Regex.Replace(myText,"(\r\n|\r|\n)+", Environment.NewLine, System.Text.RegularExpressions.RegexOptions.Multiline)
But nothing worked.