How do you use remap to insert a newline?

(lxk ) #1

Hi Team,

I Imported a phpBB forum which has a whole bunch of broken hotlinked images from a Coppermine gallery in the user’s posts.

I got copies of the original images from an old backup, have re-hosted them and I’ve had success using the posts remap and delete rakes to fix up mangled post formatting so Discourse will inline the images, and then crawl them.

I’ve hit a bit of a wall with some formatting, does anyone know how I can squeeze a newline between these image URLs?


I tried

rake posts:remap['.jpghttp://','.jpg<br/>http://']

This works visually, though because the text is still all in a single string, it’s not inlining the image. I’ve validated putting a newline between the URLs works, there’s just too many to do by hand - is there a trick I’m missing?


(Jay Pfaffman) #2

Use \n instead of <br>.

EDIT: maybe \\n?

(lxk ) #3

I thought that too, but that puts an ‘n’ between

doesn’t appear to accept regex, escaping it didn’t seem to work

(lxk ) #4

I needed both \r\n not just \n

Ended up using the database instead of remap

update posts set raw = replace(raw, '.jpghttp', '.jpg\r\nhttp');