正则表达式和 Yahoo Pipes:如何替换 url 结尾

发布于 2024-08-02 01:28:14 字数 648 浏览 7 评论 0原文

这是管道,但您可能不需要它来回答问题: http:// Pipes.yahoo.com/pipes/pipe.info?_id=85a288a1517e615b765df9603fd604bd

我正在尝试按如下方式修改所有网址:

http://mediadownloads.mlb.com/mlbam/2009/08/12/mlbf_6073553_th_3.jpg with
http://mediadownloads.mlb.com/mlbam/2009/08/12/mlbtv_6073553_1m.mp4

语法应该类似于:

In item.mediaUrl replacement f with tv 和 In item.mediaUrl replacement 1m.mp4 的最后 8 个字符

mlbf_(\d+)_.* replaced w/ mlbtv_$1_1m.mp4 

破坏了 rss 提要,尽管我知道我已经很接近了,

知道我需要什么语法吗?

Here's the Pipe though you may not need it to answer the question: http://pipes.yahoo.com/pipes/pipe.info?_id=85a288a1517e615b765df9603fd604bd

I am trying to modify all url's as so:

http://mediadownloads.mlb.com/mlbam/2009/08/12/mlbf_6073553_th_3.jpg with
http://mediadownloads.mlb.com/mlbam/2009/08/12/mlbtv_6073553_1m.mp4

The syntax should be something like:

In item.mediaUrl replace f with tv and In item.mediaUrl replace last 8 characters with 1m.mp4

mlbf_(\d+)_.* replaced w/ mlbtv_$1_1m.mp4 

breaks the rss feed though I know I am close

Any idea as to what syntax I need there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无风消散 2024-08-09 01:28:14

您的正则表达式和替换对我来说看起来不错,假设正则表达式仅应用于 URL。 如果它也应用于周围的文本,.* 的消耗往往会比您想要的多得多。 看看如果将正则表达式更改为以下内容会发生什么:

mlbf_(\d+)_[\w.]+

Your regex and replacement look okay to me, assuming the regex is being applied only to the URLs. If it were being applied to the surrounding text as well, the .* would tend to consume a lot more than you wanted. See what happens if you change the regex to this:

mlbf_(\d+)_[\w.]+
蓝礼 2024-08-09 01:28:14

我不知道这个雅虎管道是如何工作的,但是这个正则表达式应该根据这个 site

正则表达式:

.*?/([0-9]*)/([0-9]*)/([0-9]*)/mlbf_([0-9]*)_.*

替换:

http://mediadownloads.mlb.com/mlbam/$1/$2/$3/mlbtv_$4_1m.mp4

I do not know how this yahoo pipes work, but this regex should do it according this site:

Regex:

.*?/([0-9]*)/([0-9]*)/([0-9]*)/mlbf_([0-9]*)_.*

Substitution:

http://mediadownloads.mlb.com/mlbam/$1/$2/$3/mlbtv_$4_1m.mp4
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文