CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions: Simple RegEx Help! Please!: Edit Log

New User

Jun 30, 2008, 12:36 PM

Views: 8727
Simple RegEx Help! Please!

Hi there!

I'm going through a bunch of web content, and need to make all of the links relative, rather than hard-coded because I'm generating an archive to put on disk. So, instead of the link being to "/images/pic1.jpg", I want it to be "images/pic1.jpg".

I have the code ready to add before the "images" directory to make it relative. It stores the number of "../" in a variable called $path. For some reason, though, my regex doesn't work!

Basically, I want to replace anything like:
= "/anything"
= "$path/anything"

Currently, I have the following:


I've never claimed to be a RegEx pro, but I usually hack one up when I need it with great success....This one, I'm afraid, never works like I think it should!

Any help would be greatly appreciated!


(This post was edited by martygilbert on Jun 30, 2008, 12:44 PM)

Edit Log:
Post edited by martygilbert (New User) on Jun 30, 2008, 12:44 PM: fix a small typo

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives