正则表达式和Yahoo Pipes:如何替换url末尾 [英] Regex and Yahoo Pipes: How to replace end of url

查看:76
本文介绍了正则表达式和Yahoo Pipes:如何替换url末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

语法应类似于:

在item.mediaUrl中将t替换为电视,在item.mediaUrl中将最后8个字符替换为1m.mp4

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 

尽管我知道我已经很接近了,但还是中断了rss feed

breaks the rss feed though I know I am close

关于我在那里需要什么语法的任何想法?

Any idea as to what syntax I need there?

推荐答案

您的正则表达式和替换对我来说还不错,假设正则表达式仅 应用于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:

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

这篇关于正则表达式和Yahoo Pipes:如何替换url末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆