Remove new line between strings

I have this problem where I get a string using get full text and it gives me the below string:

The below contains 10 new line spaces
Ingredients.txt (4.1 KB)

I want it to be like below using any string manipulation or regex:
image

Thank you in advance for your help!

Hi

Use this expression in assign activity

stroutput = System.Text.RegularExpressions.Regex.Replace(yourString,β€œ^\s+”,β€œβ€,System.Text.RegularExpressions.RegexOptions.Multiline).Trim

Cheers @C_M1

1 Like

Thank you this one works! By the way, how did you come up with that solution? I just want to know more about regex and string manipulation, if you can recommend some tutorials it will be helpful as well! Thanks!

1 Like

give a try at the following:

Assign Activity
strCleansed =
String.Join(Environment.NewLine,System.Text.RegularExpressions.Regex.Split(strInputText, "[\s]+"))

Check this out for more insights

Cheers @C_M1

1 Like

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.