# Экранирование обратного слэша в регулярном выражении

**URL:** <https://meta.discourse.org/t/escaping-a-backslash-in-a-regex/324641>\
**Category:** Support\
**Created:** [03.Сентябрь.2024 11:21:13 UTC](https://meta.discourse.org/t/escaping-a-backslash-in-a-regex/324641 "2024-09-03T11:21:13Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![thaidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thaidb/32/68488_2.png) [@thaidb](https://meta.discourse.org/u/thaidb)\
**Post date:** [06.Сентябрь.2024 00:54:36 UTC](https://meta.discourse.org/t/escaping-a-backslash-in-a-regex/324641/5 "2024-09-06T00:54:36Z")

</div>

Всё прошло гладко. Большое спасибо, 🙂

```plaintext
Topic.where("title LIKE '%T8/2024%'").find_each do |topic|
  topic.title.gsub!(/T8\/2024/,"T9/2024")
  topic.fancy_title.gsub!(/T8\/2024/,"T9/2024")
  topic.slug.gsub!(/T8\/2024/,"T9/2024")
  puts topic.title
  begin
    topic.save!
  rescue
    puts "ой, что-то пошло не так."
  end
end

```

---

_[View the full topic](https://meta.discourse.org/t/escaping-a-backslash-in-a-regex/324641)._
