Thread: Rss2Book
View Single Post
Old 09-24-2007, 05:00 AM   #224
adinb
RSS & Gadget Addict!
adinb is on a distinguished road
 
adinb's Avatar
 
Posts: 82
Karma: 67
Join Date: May 2005
Location: Albuquerque, NM
Device: Sony PRS-500, iPod Touch, iPhone
Quote:
Originally Posted by dietric View Post
I'm trying to create a Web2Book feed for
http://www.spiegel.de/schlagzeilen/rss/0,5291,,00.xml

I would like to rewrite the links to link to the printable version, but the pattern to replace the link is somewhat complex:
The link in the feed looks like this:
http://www.spiegel.de/politik/auslan...506744,00.html
The printable version like this:
http://www.spiegel.de/politik/auslan...506744,00.html

From what I can see by examining other links the constants are:
- http://www.spiegel.de/ (obviously)
- one or more folder names
- the actual file name consists of three numbers separated by comma
- in the printable version, the string "druck-" is added before the third number
- the extension is .html

I'm not so good with RegEx, help would be appreciated.
how about (http://www.spiegel.de.*/\d,\d{4},)(\d+,\d\d\.html)
then in the link constructor you could use {1}druck-{2}

I'm all ears for a more efficient regex that is more efficient.

-adin
adinb is offline   Reply With Quote