having a tough time trying to figure this one:
here are the samples i would like to match on (match items in bold)....
http://www.mydomain.com/[b]somepage[/b] (basically anything that comes after the "/" slash)
http://www.mydomain.com/[b]somepage[/b]
However, I don't want to match anything with a .php extension or with nothing after the "/". ie...
http://www.mydomain.com
http://www.mydomain.com/index.php
http://www.mydomain.com
http://www.mydomain.com/index.php
Calling all regex gurus
Moderator: General Moderators
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Well I would do the following:
Code: Select all
$str = "http://www.sdfsdf.com/dfssdf.php";
$ending = preg_replace("~(?:(?:(?://)?.*?/))~","",$str);
if (preg_match("~\.~",$ending))
echo "no return";
else
echo "the returnable variable value is $ending";