# Replace / to \_ string

**URL:** <https://community.icinga.com/t/replace-to-string/7753>\
**Category:** Icinga 2\
**Tags:** icinga-dsl\
**Created:** [July 12, 2021, 6:16pm UTC](https://community.icinga.com/t/replace-to-string/7753 "2021-07-12T18:16:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mooneym17](https://community.icinga.com/user_avatar/community.icinga.com/mooneym17/32/3149_2.png) [@mooneym17](https://community.icinga.com/u/mooneym17)\
**Post date:** [July 12, 2021, 6:16pm UTC](https://community.icinga.com/t/replace-to-string/7753/1 "2021-07-12T18:16:41Z")

</div>

Hi all,

Struggling to understand icinga2 script language. I have a requirement to replace / with \_ for a string in a variable. I thought something like

```
  vars.testnew = test.replace('/' , '_')
```

---

<div class="post-metadata">

**Author:** ![Pooh](https://community.icinga.com/letter_avatar_proxy/v4/letter/p/f05b48/32.png) [@Pooh](https://community.icinga.com/u/Pooh)\
**Post date:** [July 12, 2021, 6:44pm UTC](https://community.icinga.com/t/replace-to-string/7753/2 "2021-07-12T18:44:55Z")

</div>

Did you try using " instead of ’ ?

Antony.

---

<div class="post-metadata">

**Author:** ![mooneym17](https://community.icinga.com/user_avatar/community.icinga.com/mooneym17/32/3149_2.png) [@mooneym17](https://community.icinga.com/u/mooneym17)\
**Post date:** [July 12, 2021, 8:05pm UTC](https://community.icinga.com/t/replace-to-string/7753/3 "2021-07-12T20:05:45Z")

</div>

i thought i did :). That works . Thanks - simple things .
