How to escape back slash in a string taken from excel cell

Hi,

I have some conditions stored in excel cell. When I read that, it is included with back slash in between. How to remove that?

in excel I have as below:
[Recorded Date] < ‘“+DateTime.Now.AddDays(-180).ToString+”’

When I read it, I am getting value as:

How to remove back slash here?
Replace is not working.

Hi @vigneshnkv ,

if Replace is not working. could you please try like below.

if replace is not working, they might not even be there.
The \ can be inserted by UiPath for display purposes, to correctly display the single quote double quote part of the string. It depends a bit on where you (re)view the string value.

But… yourExcelValue.Replace(chr(92), "") should work. chr(92) refers to the \ and avoids accidently being interpreted as an escape character in your replace expression

Regex replace is not working.

It is not even matching as character
image

Yes, it seems it is not there. But when I use it for dt.select() in filter condition. it is failing.
chr(92) replace also not working

image

And What I found now is, If it has double quotes in excel, this \ is coming.

Did you tried with three parameters one parameter you have to provide like what to replace in our case blank. Not sure can we try like below.

Ooh… A telecomunications job… Good memories there :slight_smile:

It is indeed an interesting one, that the replace does not work.
A final check that you can do to validate the actual data in the variable is to dump it (write line) in notepad for example.

Because somehow it is there or not, and the debug fields of uipath treat all output as JSON and thus escape stuff.

Edit: does your find and replace throw an error, or simply nothing is replaced?

kindly note the visual representation e.g. immediate panel showing a \ is not refelcting the string as it is in real.

grafik

If I use chr(92), no error and no replace happened. screenshot in my previous reply.

If I use as below, error:
image

Not working

ok. lets see what our fellow members will say on this. thanks.