搜索URL模式并使用REGEX在MySql上替换它

时间:2019-12-11 06:20:42

标签: mysql regex

我正在尝试从一系列数据表中搜索所有以https://institute-of-coaching.com/......./?id=...&utm_source=...&utm_campaign=....&utm_medium=....开头的URL,这些数据表在HTML标记下包含该模式

<a href=""institute-of-coaching.com/sf-webinar-sfw-5d-bha-dg/?id=sjn7962lmk&amp;utm_source=Coaching-Skills-Article-Banner&amp;utm_medium=Coaching-Skills-Article&amp;utm_campaign=Coaching-Skills-Blog"" target=""_blank"" rel=""noopener noreferrer""><img class=""aligncenter"" src=""....../banner-3.png"" alt=""coaching skills 17"" width=""618"" height=""234""></a>" 

我已经尝试在MYSQL上进行搜索,但是没有成功:

select * 
from ch_posts 
where post_content RLIKE '(institute-of-coaching\.com\/sf-webinar-sfw-5d-bha-dg\/?)\w*(=).([A-Za-z0-9])\w*([&][a-z]).*(target=)';

任何人都可以帮助我调试此问题并实现我的目标,以搜索URL并将其替换为没有UTM参数的URL。

0 个答案:

没有答案