Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Matching a breadcrumb style URL

Posted on 2008-10-28
3
Medium Priority
?
230 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 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