Yes I get that

But if in the pagetext there was a link to the fullsized image, this would also get modified to read /medium/.
I think the safest idea will be to create a huge loop that goes through each post, looking for the /data/XXXX/XXX-med.jpg and renaming that. Will probably take sometime, but will make sure nothing mucks up!
You can't do regular expressions in mySQL can you?