正则表达式和 Yahoo Pipes:如何替换 url 结尾
这是管道,但您可能不需要它来回答问题: 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的正则表达式和替换对我来说看起来不错,假设正则表达式仅应用于 URL。 如果它也应用于周围的文本,
.*
的消耗往往会比您想要的多得多。 看看如果将正则表达式更改为以下内容会发生什么: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:我不知道这个雅虎管道是如何工作的,但是这个正则表达式应该根据这个 site:
正则表达式:
替换:
I do not know how this yahoo pipes work, but this regex should do it according this site:
Regex:
Substitution: