网站中的图片路径变了
原来图片网址是 http://pic.yupoo.com/zgzsscmh/COM4V4Ya/IFJ3R.jpg
现在想把 里面的/ 替换掉
变成 http://pic.yupoo.com/zgzsscmh-COM4V4Ya-IFJ3R.jpg
只替换两个 ,其它不替换
大神们 需要正则写吗,怎么写
使用replace
函数
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
update test_table set url = replace(url, 'http://pic.yupoo.com/zgzsscmh/', 'http://pic.yupoo.com/')
url -> replace(url, 'http://pic.yupoo.com/zgzsscmh/', '囧')
url -> replace(url, '/', '-')
url -> replace(url, '囧', 'http://pic.yupoo.com/zgzsscmh-')
or
https://github.com/hholzgra/mysql-udf-regexp