Solved

Matching a breadcrumb style URL

Posted on 2008-10-28
3
228 Views
Last Modified: 2010-05-18
Hello

I need to do a regex replace of a URL for example:

http://localhost/index.php?page=About_Us&page=Our_Address&page=Map

this needs to be re-written as:

http://localhost/About_Us/Our_Address/Map

Does anyone know how this can be done for multiple instances of page=?

Thanks

Jonathan
0
Comment
Question by:jwfranklin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
ddrudik earned 125 total points
ID: 22819918

echo preg_replace('#(?<=^http://localhost)[^?]*\?page=|&page=#','/',$sourcestring);

Open in new window

0
 
LVL 1

Author Closing Comment

by:jwfranklin
ID: 31510645
Spot on, that works fine. Thanks
0
 
LVL 27

Expert Comment

by:ddrudik
ID: 22822316
Thanks for the question and the points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question