gary_rip Posted February 25, 2009 Share Posted February 25, 2009 Hey All... a little help needed if you will? This is the code that i am scraping from a site. <li>1455° <a style="position:relative; display:inline;" <li>795° <a style="position:relative; display:inline;" <li>59° <a style="position:relative; display:inline;" <li>49° <a style="position:relative; display:inline;" <li>4° <a style="position:relative; display:inline;" I would like to take just the number. Ive been using this code... <?php $regex = '/<li>(.+?)$/i'; preg_match_all($regex,$data,$match4); ?> Which i have tested on http://www.rubular.com/ and it seems it should work, but in practice it does not. Any suggestions? EDIT: Here is a perma link to Rubular with info filled in... http://www.rubular.com/regexes/6315 Quote Link to comment https://forums.phpfreaks.com/topic/146851-solved-regex-with-a-degree-character/ Share on other sites More sharing options...
effigy Posted February 25, 2009 Share Posted February 25, 2009 You need to use the /m modifier if you want $ to match around all new lines, rather than just the end of the string. Quote Link to comment https://forums.phpfreaks.com/topic/146851-solved-regex-with-a-degree-character/#findComment-770962 Share on other sites More sharing options...
gary_rip Posted February 25, 2009 Author Share Posted February 25, 2009 spot on! thanks v.much! Quote Link to comment https://forums.phpfreaks.com/topic/146851-solved-regex-with-a-degree-character/#findComment-770987 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.