in reply to Performing substitutions in MySQL

UPDATE my_table SET imageurl = CONCAT( LEFT(imageurl, LENGTH(imageurl) - INDEX( imageurl, '.jpg') ) ,'.gif'\ )

You'll have to play with it to make sure there isn't an off-by-one error.