Replacing content in multiple topics with Regex?


in a lot of my imported content i have a link from the old domain in topics i imported like this:

where xxxx is represented by a 4 digit thread number,

I just want to complete remove this string from all topics, what would be the best way to achieve this en-bulk to 3,000+ topics?


This should help:

1 Like

Hey thanks!

rake posts:delete_word['^http:\/\/\/threads\/.*.\/$','regex']

pulls up 0 results, know where I’m going wrong?


rake posts:delete_word['https?://domain\.com/threads/\\d{4}','regex']

Amazing! worked perfectly, been reading the post you linked and im trying to build a regex for removing RGB BB code.

RegEx builder states my regex is valid:

However when running it, it either updates 0 posts or I get an error stating it isn’t a valid regex.

This his how the BBcode is in topics:

[COLOR=rgb(95, 66, 222)]

Also tried this:

rake posts:delete_word[‘[\WCOLOR=rgb((\d{1,3}), (\d{1,3}), (\d{1,3})(, ){0,1}(0(.\d+)?|1(.0+)?))]’,‘regex’]

Wouldn’t you rather have those links work? And maybe just change the hostname?

You can use my example in the other topic where this was discussed for how to do it in rails and use to tweak your regex.

1 Like