tarlejh Posted February 23, 2009 Share Posted February 23, 2009 So I want to accept a URL that might contain a 7-digit number (e.g. http://www.domain.com/index.php/#1234567). If it does contain a 7-digit number, I want to grab it from the string and assign it to a variable. If it does not, I want to assign false. So how might this be achieved? Using some string handling function or combination thereof (duh) but can anyone here code it off the top of their head? Thank you in advance for any assistance. Link to comment https://forums.phpfreaks.com/topic/146546-how-do-i-extract-a-matching-reg-expression-from-a-string/ Share on other sites More sharing options...
rhodesa Posted February 23, 2009 Share Posted February 23, 2009 you can get the fragment with $_SERVER['REQUEST_URI'] and http://us.php.net/parse_url Link to comment https://forums.phpfreaks.com/topic/146546-how-do-i-extract-a-matching-reg-expression-from-a-string/#findComment-769376 Share on other sites More sharing options...
tarlejh Posted February 23, 2009 Author Share Posted February 23, 2009 you can get the fragment with $_SERVER['REQUEST_URI'] and http://us.php.net/parse_url Awesome! Thanks. Link to comment https://forums.phpfreaks.com/topic/146546-how-do-i-extract-a-matching-reg-expression-from-a-string/#findComment-769391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.