pgrevents Posted May 8, 2009 Share Posted May 8, 2009 I am trying to grab information out of this <div style="overflow: hidden; background-image: url(http://s.bebo.com/img/bebobadge_1_black.gif); background-repeat: no-repeat; width: 300px; height: 175px;"><span style="width:90px; height:90px;"><a href="http://www.bebo.com/badge/9211222062"><img src="http://www.bebo.com/profilephoto/9211222062a1363459018bblack.jpg" style="border: 0pt none ; margin: 10px 0pt 27px 10px; width: 90px; height: 90px;"></a></span><br><a href="http://www.bebo.com/badge/9211222062" style="padding: 0pt 0pt 0pt 10px; overflow: hidden; display: block; color: white; font-weight: bold; font-size: 16px; width: 300px;">PGR Events</a><a href="http://www.bebo.com/badge/9211222062" style="padding: 0pt 0pt 0pt 10px; display: block; color: white; font-weight: bold; font-size: 12px;">http://www.bebo.com/pgrevents</a><br></div> specifcly the profile photo bit http://www.bebo.com/profilephoto/9211222062a1363459018bblack.jpg As you will notice with the code i am trying to get is numbers then a then numbers... I can get the numbers before the a fine using; <?php session_start(); $catch = $_POST['code']; preg_match('#/profilephoto/a(\d+)#', $catch, $match); $pop = array_pop($match); ?> Its the part after the letter I cannot seem to grab. Am I on the right track here or is there another most probably easier way lol thanks Paul Quote Link to comment https://forums.phpfreaks.com/topic/157431-solved-preg_match-help/ Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 preg_match('#/profilephoto/(.+)?\.', $catch, $match) Quote Link to comment https://forums.phpfreaks.com/topic/157431-solved-preg_match-help/#findComment-829917 Share on other sites More sharing options...
pgrevents Posted May 8, 2009 Author Share Posted May 8, 2009 thanks works a treat Quote Link to comment https://forums.phpfreaks.com/topic/157431-solved-preg_match-help/#findComment-829949 Share on other sites More sharing options...
nrg_alpha Posted May 8, 2009 Share Posted May 8, 2009 One caveat about using .+ (reply #11 and #14 explain the potential issues with those - speed and accuracy). Another alternative could be: preg_match('#/profilephoto/([^.]+)\.#', $catch, $match); Quote Link to comment https://forums.phpfreaks.com/topic/157431-solved-preg_match-help/#findComment-829953 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.