Alter URLs with Regex Expression

Top  Previous  Next

The Problem

 

In late 90's web links looked like this:

 

http://www.site.com/image01.jpg

 

You can easily spot the image name. So basic media downloader can do the same.

 

Today there are many dynamic sites on the Internet. And oftentimes links look like this one

 

http://flickr.com/photos/randomusername/407910537/

 

So the problem is: How one tells what is image file name in the above link? How about old media downloader?

 

The Solution

 

Picture Ripper 4 is here to help - Alter URL's with Regex Expression has been designed to address this problem.

 

saveas_url_rewrite

How It Works?

 

Before Picture Ripper can save downloaded file, it has to decide what file name is. You can assist it with Pre-Save As URL Rewrite Rule.

Picture Ripper will use the rule to rewrite the URL and then extract file name.

 

For example, Picture Ripper has to save file downloaded from this URL:

 

http://store.warehouse.com/Images.aspx?PIID=541466

 

As you can see the image name is undefined, but we have something that looks like a product ID. We can use this ID as image file name.

To accomplish this, we need to define the following regex rewrite rule:

 

Images.aspx\?PIID=([0-9]+)

 

Then we define replacement rule:

 

$1.jpg

 

Picture Ripper will process the url and rewrite so it looks like this one:

 

http://store.warehouse.com/541466.jpg

 

Now Picture Ripper will see the file name in the URL and save it properly

 

More info

 

You may learn how to use regex & replace by visiting these online resources:

 

http://www.regular-expressions.info/brackets.html
http://www.webreference.com/js/column5/values.html