PDA

View Full Version : Anyone know regular expressions?


tim
27th of June 2009 (Sat), 23:25
I want to be able to read rss news on my handheld offline, and I want to link to the print friendly versions of stories. Can anyone help with a regular expression to turn this

http://www.healthnewsdigest.com/news/financial%20health0/Flowers_Can_Help_You_Sell_Your_Home2.shtml

into this?

http://www.healthnewsdigest.com/news/financial%20health0/Flowers_Can_Help_You_Sell_Your_Home2_printer.shtml

ie I just need to insert _printer before the .shtml

ocabj
28th of June 2009 (Sun), 14:47
Assuming Perl:


$url = "http://www.healthnewsdigest.com/news/financial%20health0/Flowers_Can_Help_You_Sell_Your_Home2.shtml"
$url =~ s/\.shtml$/_printer\.shtml/;

tim
28th of June 2009 (Sun), 17:31
Thanks :)