murfy Posted December 16, 2013 Share Posted December 16, 2013 (edited) Hello I need help with this reg. exp. for preg_match_all @(?<=style=\"display: inline\">)\d{1,3}(?=\.?<)@ Subject: <span style="display: inline">113</span><span class="qazL">.</span><span style="display: inline">111</span Returns: array ( 0 => array ( 0 => '113', 1 => 30, ), ) Should return values 113 and 111 in the array. How to correct this? Tested here: http://www.functions-online.com/preg_match.html Edited December 16, 2013 by murfy Quote Link to comment Share on other sites More sharing options...
murfy Posted December 16, 2013 Author Share Posted December 16, 2013 preg_match_all("@(?<=style=\"display: inline\">)\d{1,3}(?=\.?<)@", $subject, $matches, PREG_OFFSET_CAPTURE, 0); Should return values 113 , 30 and 111 , 96 in the array. How to correct this? Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 16, 2013 Share Posted December 16, 2013 preg_match_all("#<span style=\"display: inline\"[^>]*>(\d*)#is", $subject, $matches, PREG_OFFSET_CAPTURE); echo "<pre>" . print_r($matches, 1) . "</pre>"; Output: Array ( [0] => Array ( [0] => Array ( [0] => 113 [1] => 0 ) [1] => Array ( [0] => 111 [1] => 68 ) ) [1] => Array ( [0] => Array ( [0] => 113 [1] => 30 ) [1] => Array ( [0] => 111 [1] => 98 ) ) ) Quote Link to comment Share on other sites More sharing options...
murfy Posted December 16, 2013 Author Share Posted December 16, 2013 I see no error in the code, the testing page (see link above) fails to print it correctly. Problem solved. 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.