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 Link to comment https://forums.phpfreaks.com/topic/78386-solved-simple-regex-help/ 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; Link to comment https://forums.phpfreaks.com/topic/78386-solved-simple-regex-help/#findComment-396682 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. Link to comment https://forums.phpfreaks.com/topic/78386-solved-simple-regex-help/#findComment-396792 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 Link to comment https://forums.phpfreaks.com/topic/78386-solved-simple-regex-help/#findComment-397194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.