Ventrilo
(Jason)
1
Hey,
in a lot of my imported content i have a link from the old domain in topics i imported like this:
https://domain.com/threads/xxxx
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?
Ventrilo
(Jason)
3
Hey thanks!
rake posts:delete_word['^http:\/\/domain.com\/threads\/.*.\/$','regex']
pulls up 0 results, know where I’m going wrong?
Try:
rake posts:delete_word['https?://domain\.com/threads/\\d{4}','regex']
Ventrilo
(Jason)
5
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’]
pfaffman
(Jay Pfaffman)
6
Wouldn’t you rather have those links work? And maybe just change the hostname?
pfaffman
(Jay Pfaffman)
7
You can use my example in the other topic where this was discussed for how to do it in rails and use http://rubular.com/ to tweak your regex.
1 Like