用不同的字符串替换URL
我尝试将所有URL与另一个URL替换为MariadB数据库(10.3.31)
URL的示例:
https://website.com/download/8fd4g8er4ger5f84/filename.zip
https://website.com/download/fggf4hf5gh4/filename.zip
https://website.com/download/1v8t77hth/filename.zip
https://website.com/download/fgh48rt4g/filename.zip
我想替换:https://website.com/download/8fd4g8er4ger4ger4ger5f84
(<哈希文件夹名称) 使用我的新URL:https://newurl.com/download/filename.zip
我过去曾经使用过“ update/replace” sql命令,但是我不知道如何处理唯一的hash像上面的名称文件夹
对我有帮助吗?
编辑:找到它
找到了:
update table_name set column_name = regexp_replace(column_name,'weblot.com/download/(.Forage':)/','newwebsite.com/download/')
I try to replace all my URL with another into my mariadb database (10.3.31)
URL's Example :
https://website.com/download/8fd4g8er4ger5f84/filename.zip
https://website.com/download/fggf4hf5gh4/filename.zip
https://website.com/download/1v8t77hth/filename.zip
https://website.com/download/fgh48rt4g/filename.zip
I want to replace : https://website.com/download/8fd4g8er4ger5f84
(< this using different hash folder name)
with my new URL : https://newurl.com/download/filename.zip
I used "update / replace" SQL command in the past, but I don't know how to do with unique hash name folder like above
Help me please?
EDIT : Found it
Found it :
UPDATE table_name SET column_name = REGEXP_REPLACE(column_name, 'website.com/download/(.*?)/', 'NEWwebsite.com/download/')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,请使用正则
Use Regex in this case