How can I remove duplicate backslashes from an URL?
C:\\Users\\User\\Desktop\\Document.xlsx
Should be
C:\Users\User\Desktop\Document.xlsx
I’m trying this, but since i just started trying to learn Regex expressions it clearly doesn’t work.
System.Text.RegularExpressions.Regex.Replace(Transaction, /([^:]/)/+/g)
1 Like
lakshman
(Ganta lakshman)
June 8, 2019, 4:31pm
2
@LarsFeilberg
Welcome to the UIpath Community.
Try this:
String Str = “C:\Users\User\Desktop\Document.xlsx”
Str.Replace("\\","\")
1 Like
Thanks alot, lakshman!
Oh, I see. That was a quite more convenient work-around I inted to use, instead of having to use Regex. Sometimes the more complex a problem seems, the more elegantly it can be solved
Cheers!
3 Likes
If you are still interested in regex.
New Regex("\\{2,}").Replace(Transaction, "\")
3 Likes