# 100만 개 게시물에서 여러 정규식으로 문자열을 가장 빠르게 교체하는 방법은?

**URL:** <https://meta.discourse.org/t/whats-the-fastest-way-to-replace-strings-with-multiple-regexes-in-1-million-posts/161749>\
**Category:** Product Support\
**Created:** [8월 22, 2020, 10:21오전 UTC](https://meta.discourse.org/t/whats-the-fastest-way-to-replace-strings-with-multiple-regexes-in-1-million-posts/161749 "2020-08-22T10:21:13Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [8월 22, 2020, 10:21오전 UTC](https://meta.discourse.org/t/whats-the-fastest-way-to-replace-strings-with-multiple-regexes-in-1-million-posts/161749/1 "2020-08-22T10:21:13Z")

</div>

vBulletin 가져오기 이후, 가져온 메시지들에서 많은 부분을 수정해야 합니다.

**많은** 수의 오래된 BBcode 태그를 수정, 교체 또는 삭제해야 합니다.

다음 링크를 확인해 보았습니다: [Replace a string in all posts](https://meta.discourse.org/t/replace-a-string-in-all-posts/48729)

160만 개의 게시물이 있으므로 실수를 하고 싶지 않습니다.

1. 모든 게시물에서 문자열을 교체하기 전에 테스트를 위해 특정 게시물 1개만 대상으로 할 수 있는 방법이 있을까요?  
다양한 컨텍스트에서 여러 BB태그가 포함된 “test” 게시물을 내 포럼에 생성해 두었습니다.

2. 100만 개 이상의 게시물에서 문자열을 교체하는 데 얼마나 걸릴까요?  
시간이 많이 걸린다면 더 빠른 방법이 있을까요? 데이터베이스에서 텍스트를 직접 편집하는 것이 가능할까요?

3. 여러 교체를 한 번에 수행할 수 있는 방법이 있을까요? (예: `[quote]` 태그 앞뒤에 새 줄 추가, `[b]`와 `[i]`를 `**`와 `*`로 교체, `[color`와 `[indent`] 제거 등)

수정: rails를 통해 게시물의 원본(raw) 콘텐츠에 이러한 수정 사항을 적용한 후, 모든 게시물을 다시 베이킹(rebake)하면 효과가 있을까요?

---

_[View the full topic](https://meta.discourse.org/t/whats-the-fastest-way-to-replace-strings-with-multiple-regexes-in-1-million-posts/161749)._
