# phpBBインポート後のクォーテーションの修正

**URL:** <https://meta.discourse.org/t/fix-quotes-after-phpbb-import/79133>\
**Category:** Product Support\
**Created:** [2018 年 1 月 27 日午前 1:39 UTC](https://meta.discourse.org/t/fix-quotes-after-phpbb-import/79133 "2018-01-27T01:39:46Z")\
**Posts on this page:** 1\
**Showing post:** 61

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2018 年 1 月 31 日午前 8:21 UTC](https://meta.discourse.org/t/fix-quotes-after-phpbb-import/79133/61 "2018-01-31T08:21:50Z")

</div>

> [@omarfilip](#):
>
> strings like ----Original message----, or Sent from my iPhone, etc.

> [@bekircem](#):
>
> multiple value expressions like [color=#] or [font=] tags

It should for the most part be possible to modify the regex

```plaintext
~* '\[quote[^]]*]'
.....
regexp_replace(posts.raw, '\[(/)?quote([^]]*)]', E'\n[\\1quote\\2]\n', 'g')

```

so that it can find (the ~\* case insensitive “LIKE” line) and replace (the table.field, pattern, replacement, flag line) characters and combinations of characters.

The trick is knowing exactly what to match so that it will both match what you want it to and _not_ match what you want it _not_ to. If the pattern is always and only the same characters it can be matched more easily. But maybe at times too easily eg. it is easy to match “cat” but you wouldn’t want to change “category” to “egory”.

As for trailing content a pattern something like ‘character string(.)\*’ (google “regex everything atom”) should work as long as the string doesn’t include any “special” characters.

As for the font and color bbcode tags, if these are in only raw and not causing a problem with the cooked, I wouldn’t bother worrying about them. If they are a problem, changing the string “quote” to “font” and then “color” and changing the replacement to an empty string should work if you only want to remove the tags entirely. If case is a concern, changing the flag to ‘gi’ _should_ work. _Test First!_

Documentation:

> **[9.7. Pattern Matching](https://www.postgresql.org/docs/9.3/functions-matching.html)**
>
> 9.7. Pattern Matching # 9.7.1. LIKE 9.7.2. SIMILAR TO Regular Expressions 9.7.3. POSIX Regular Expressions There are three separate approaches to …

---

_[View the full topic](https://meta.discourse.org/t/fix-quotes-after-phpbb-import/79133)._
