views:

474

answers:

2

Here's the Pipe though you may not need it to answer the question: http://pipes.yahoo.com/pipes/pipe.info?%5Fid=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?

A: 

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
Håkon
+1  A: 

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.]+
Alan Moore
The regex works, but you're right, he could be replacing past the end of the URL.
seanmonstar