# How to insert "\\\\" before multiple "\_" in a string?

**URL:** <https://discourse.julialang.org/t/how-to-insert-before-multiple-in-a-string/47882>\
**Category:** New to Julia\
**Created:** [October 6, 2020, 7:44pm UTC](https://discourse.julialang.org/t/how-to-insert-before-multiple-in-a-string/47882 "2020-10-06T19:44:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [October 6, 2020, 7:44pm UTC](https://discourse.julialang.org/t/how-to-insert-before-multiple-in-a-string/47882/1 "2020-10-06T19:44:33Z")

</div>

Hello!

Suppose I have:

```julia
str = "Hello_this_is_string"

```

How would I make it like this:

```julia
str_transform = "Hello\\_this\\_is\\_string"

```

In a programmatic way?

Kind regards

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [October 6, 2020, 7:47pm UTC](https://discourse.julialang.org/t/how-to-insert-before-multiple-in-a-string/47882/2 "2020-10-06T19:47:35Z")

</div>

With the [`replace`](https://docs.julialang.org/en/v1/base/strings/#Base.replace-Tuple%7BAbstractString,Pair%7D) function:

```julia
julia> replace("Hello_this_is_string", "_" => "\\_")
"Hello\\_this\\_is\\_string"

```
