# Replace double backslashes // with one / in a string

**URL:** <https://discuss.elastic.co/t/replace-double-backslashes-with-one-in-a-string/165858>\
**Category:** Logstash\
**Created:** [January 26, 2019, 5:59pm UTC](https://discuss.elastic.co/t/replace-double-backslashes-with-one-in-a-string/165858 "2019-01-26T17:59:55Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [January 26, 2019, 9:36pm UTC](https://discuss.elastic.co/t/replace-double-backslashes-with-one-in-a-string/165858/4 "2019-01-26T21:36:28Z")

</div>

Oh, OK, I didn't get that. You could change double backslash to single using a similar regexp that matches two backslashes with a capture group to keep the second one...

```
gsub => ["message", "[\\]([\\])", "\1" ]
```

---

_[View the full topic](https://discuss.elastic.co/t/replace-double-backslashes-with-one-in-a-string/165858)._
