You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Google Sheets中替换URL指定分类部分为'dagdeals'

Google Sheets 替换URL指定分段内容的解决方案

直接使用REGEXREPLACE函数即可一步完成需求,无需拆分使用REGEXEXTRACT和SUBSTITUTE。针对你的URL结构,公式如下:

=REGEXREPLACE(A1, "(https://trips.holidayguru.nl/packages/)[^/]+/", "$1dagdeals/")

公式说明

  • A1:替换为存放原始URL的单元格地址
  • (https://trips.holidayguru.nl/packages/):匹配URL固定前缀并捕获为分组1,确保替换位置准确
  • [^/]+/:匹配前缀后第一个非斜杠的字符串(即需要替换的分类名)及后续斜杠
  • $1dagdeals/:将捕获的固定前缀与dagdeals/拼接,完成替换

示例验证

原始URL:https://trips.holidayguru.nl/packages/nederland/cd4ea4f1-3189-4a60-8ad1-60e1a15bdccf/
替换后结果:https://trips.holidayguru.nl/packages/dagdeals/cd4ea4f1-3189-4a60-8ad1-60e1a15bdccf/

原始URL:https://trips.holidayguru.nl/packages/weekendje-weg/4fbce498-cb07-4032-94e4-903bb29af772/
替换后结果:https://trips.holidayguru.nl/packages/dagdeals/4fbce498-cb07-4032-94e4-903bb29af772/

内容的提问来源于stack exchange,提问作者Sami Chouchane

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 15:50:11