Stephen68 Posted November 22, 2007 Share Posted November 22, 2007 Hey I have a referred URL that is really long, I would like to chop it down to the first question mark (?). I trying to get a grasp of this regex but I'm finding it hard to take in this morning anybody give me a hand please. Stephen Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 22, 2007 Share Posted November 22, 2007 consider this code you do not really have to use regular expression $strUrl = "http://www.somedomain.com/somepage.php?test2223=2333.."; $strActualUrl = substr($strUrl,0,strpos($strUrl,"?")); echo $strActualUrl; Quote Link to comment Share on other sites More sharing options...
Orio Posted November 22, 2007 Share Posted November 22, 2007 When everybody will use PHP6 it will be simpler... <?php $strUrl = "http://www.somedomain.com/somepage.php?test2223=2333.."; $strActualUrl = strstr($strUrl, "?", TRUE); ?> Orio. Quote Link to comment Share on other sites More sharing options...
Stephen68 Posted November 23, 2007 Author Share Posted November 23, 2007 Thanks for all the help guys, that did the trick 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.