# Replace string escape in an expression

**URL:** <https://forum.inductiveautomation.com/t/replace-string-escape-in-an-expression/6489>\
**Category:** Ignition\
**Created:** [May 15, 2013, 7:46pm UTC](https://forum.inductiveautomation.com/t/replace-string-escape-in-an-expression/6489 "2013-05-15T19:46:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![onestank](https://avatars.discourse-cdn.com/v4/letter/o/ba9def/32.png) [@onestank](https://forum.inductiveautomation.com/u/onestank)\
**Post date:** [May 15, 2013, 7:46pm UTC](https://forum.inductiveautomation.com/t/replace-string-escape-in-an-expression/6489/1 "2013-05-15T19:46:20Z")

</div>

I am trying to edit the value returned from the file explorer component selected path. My selected path would be like [color=#0000BF]P:\OWSTransfer\Scanner\_INI\EC\_first.INI[/color] and i want to replace the [color=#0000BF]P:\OWSTransfer\Scanner\_INI[/color] with [color=#0000BF]C:[/color] to have a result of [color=#0000BF]C:\EC\_first.INI[/color]

```auto
replace("{Root Container.ChainRails 2.File Explorer.selectedPath}", “P:\OWSTransfer\Scanner_INI”, “C:”)
```

The error reads  
Scan Error: Illegal escape sequence"\O| (Line1 , Char 72)

I have also tried

```auto
replace("{Root Container.ChainRails 2.File Explorer.selectedPath}", escapeXML(“P:\OWSTransfer\Scanner_INI”), “C:”)
```

With similar error

So how do I escape in an Expression?

---

<div class="post-metadata">

**Author:** ![onestank](https://avatars.discourse-cdn.com/v4/letter/o/ba9def/32.png) [@onestank](https://forum.inductiveautomation.com/u/onestank)\
**Post date:** [May 15, 2013, 7:55pm UTC](https://forum.inductiveautomation.com/t/replace-string-escape-in-an-expression/6489/2 "2013-05-15T19:55:23Z")

</div>

I got help here from another guy should read:

```auto
replace({Root Container.ChainRails 2.File Explorer.selectedPath}, "P:\\OWSTransfer\\Scanner_INI", "C:")
```

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [May 15, 2013, 8:06pm UTC](https://forum.inductiveautomation.com/t/replace-string-escape-in-an-expression/6489/3 "2013-05-15T20:06:13Z")

</div>

Yup, you got it - have to escape the escape character.
