i need some help with some regular expressions and some string operations.
i am new to php, and cant manage to get my head around the construction of regexes...
if you can solve this problem i would be most happy.
if you can explain the process how you solved it, i would be more than most happy.
$localsource1 = "http://localhost/00/website/page1.php
$localsource2 = "http://localhost/00/website/page2.php?fn=3&con=1U1q1I1P1PfZXgl
at the moment i am working in a local server, but this will go to a production server later on, so the URLs would change to:
$prodsource1 = "http://www.website.com/page1.php
$prodsource2 = "http://www.website.com/page2.php?fn=3&con=1U1q1I1P1PfZXgl
what i need the regular expression(s) to do is truncate the two strings to this:
$localsource1 = "website/page1.php";
$localsource2 = "website/page2.php";
$prodsource1 = "website.com/page1.php";
$prodsource2 = "website.com/page2.php";
search for the word "website" and delete all left side characters
then search for the word "php" and delete all right side characters.
keep the middle and pass on.