# Fix quotes after phpBB import

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

<div class="post-metadata">

**Author:** ![Tomasz136472](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomasz136472/32/85114_2.png) [@Tomasz136472](https://meta.discourse.org/u/Tomasz136472)\
**Post date:** [February 27, 2018, 12:40am UTC](https://meta.discourse.org/t/fix-quotes-after-phpbb-import/79133/79 "2018-02-27T00:40:17Z")

</div>

> [@cmwebdev](#):
>
> [member=4953]username[/member]

Hi,

Ok the easiest would be to break that into 2 separate replace like so:

```plaintext
UPDATE posts set raw = regexp_replace(raw, '\[member=(\d){0,4}]', '@', 'g') where raw like '%member=%';
UPDATE posts set raw = replace(raw, '[/member]', '') where raw like '%[/member]%';

```

Remember that sometimes depending on your enviroment you would have to escape special characters.

I would suggest you use a playground like this one to understand what is going on first:

[https://regexr.com/](https://regexr.com/)

There is also a nice tutorial here:

> **[RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs](https://regexone.com/lesson/introduction_abcs)**
>
> RegexOne provides a set of interactive lessons and exercises to help you learn regular expressions

For instance here is what I used for old emoticons that were still present on my board from old times:

```plaintext
update posts set raw = REPLACE(raw, 'B)', ' :slight_smile: ') where raw like '%B)%';
update posts set raw = REPLACE(raw, ':LOL:', ' :wink: ') where raw like '%:LOL:%';
update posts set raw = REPLACE(raw, ':wub:', ' :heart_eyes: ') where raw like '%:wub:%';
update posts set raw = REPLACE(raw, ':0', ' :open_mouth: ') where raw like '%:0%';
update posts set raw = REPLACE(raw, ':o', ' :open_mouth: ') where raw like '%:o%';

```

and some regex to clear up old user imports of whole html pages…

```plaintext
UPDATE posts set raw = regexp_replace(raw, '\[/?(size|font)=?“?"?\d{0,2}”?"?\]', '', 'g') where raw like '%size%' or raw like '%font%';
UPDATE posts set raw = regexp_replace(raw, '\[font=“?"?(\w+)(.(\w+))*“?"?\]', '', 'g') where raw like '%font=%';
UPDATE posts set raw = regexp_replace(raw, '\[/(font|color|background|center|i)\]', '', 'g') where raw like '%/font%' or raw like '%/color%' or raw like '%/background%' or raw like '%/center%' or raw like '%[/i%';
UPDATE posts set raw = regexp_replace(raw, '\[(center|i)\]', '', 'g') where raw like '%[center%' or raw like '%[i%';
UPDATE posts set raw = regexp_replace(raw, '\[/?(left)\]', '', 'g') where raw like '%left%';
UPDATE posts set raw = regexp_replace(raw, '\[/?(color="?#?).{0,8}"?\]', '', 'g') where raw like '%color=%';
UPDATE posts set raw = regexp_replace(raw, '\[(background=rgb).{10,15}\]', '', 'g') where raw like '%background=rgb%';

```

Hope it helps someone!

---

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