How do you use remap to insert a newline?

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?

http://picture.url/image.jpghttp://picture.url/image2.jpg

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?

Ideas?

Use \n instead of <br>.

EDIT: maybe \\n?

3 Likes

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

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

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');

2 Likes