Im looking for a solution I can use in PHP. Is there a way todo that in PHP oleber?
Main Topics
Browse All TopicsI would like a function / regular expressions that will take a HTML page and fix all the HTML paths so they are root relative.
e.g.
<a href="index.html">Home</a>
would become
<a href="/index.html">Home</a
I need this to work for links, image src and FLASH object/embed src and background images url's set in the style.
Any links or src which have http:// or https:// in or are internal page link anchors should be ignore.
Thanks.
This question is in progress.
Our experts are working on an answer right now.
Sign up for immediate access to the solution once it becomes available.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sorry here is more detail.
Try it in a php page you get -
Parse error: syntax error, unexpected '/', expecting ')' in the regular expression.
I changed the code to attached code snippet which works but not as expected.
I added quotes and changed https to http.
The /$1 part this matches the whole pattern and adds a / before it?
I tried \\0 instead of $1 which is the whole pattern but it just comes out like
<IMG /src="images/test.jpg" border="0">
What part of the regular expression does $1 match is all of it or is it this part - (?!http?:\/\/) ?
Sorry my regular expression skills are poor.
Business Accounts
Answer for Membership
by: oleberPosted on 2008-05-22 at 22:35:33ID: 21629577
Can this be done in Perl?
/<a href="my_func($1)">/eg
The simpler way would be to capture the links
s/<\s*a\s+href="(.*?)"\s*>
Inside the my_func, you van transform your URL as you need