# Strip incoming email subject?

**URL:** <https://meta.discourse.org/t/strip-incoming-email-subject/132242>\
**Category:** Product Support\
**Created:** [30 oktober 2019 om 13:57 UTC](https://meta.discourse.org/t/strip-incoming-email-subject/132242 "2019-10-30T13:57:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [30 oktober 2019 om 16:14 UTC](https://meta.discourse.org/t/strip-incoming-email-subject/132242/2 "2019-10-30T16:14:30Z")

</div>

I thought that there was code in there to strip that, but it’s been 3 years since I’ve done an mbox migration.

The title gets set in `...mbox/`importer.rb`:

```plaintext
    def map_first_post(row)
      mapped = map_post(row)
      mapped[:category] = category_id_from_imported_category_id(row['category'])
      mapped[:title] = row['subject'].strip[0...255]
      mapped
    end

```

You can change the title line to something like:

```
  mapped[:title] = row['subject'].strip[0...255].gsub(/^[.*?\]/,"")

```

I rarely get regex’s right the first time, so you’ll want to do a bit of testing (and maybe experiment at [http://rubular.com/](http://rubular.com/)).

---

_[View the full topic](https://meta.discourse.org/t/strip-incoming-email-subject/132242)._
