N-Bomb(Nerd) Posted January 23, 2012 Share Posted January 23, 2012 Hello, I have a string like such: http://logs.coolbeans.net/character/name/QAkHcdcSSjLfus I'm trying to get the content after the last "/" (in this case: QAkHcdcSSjLfus). I tried using this as my expression, but it failed me "~http\://logs\.coolbeans\.net/character/name/(.*?)~". When doing if(preg_match("~http\://logs\.coolbeans\.net/character/name/(.*?)~", $string, $results) the if expression is true, but $results won't contain the value I want. How do I do this? Thanks. Quote Link to comment Share on other sites More sharing options...
trq Posted January 23, 2012 Share Posted January 23, 2012 Your probably better off using parse_url and basename. Quote Link to comment Share on other sites More sharing options...
N-Bomb(Nerd) Posted January 23, 2012 Author Share Posted January 23, 2012 basename() works perfectly! Thanks!. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.