yolop Posted January 18, 2009 Share Posted January 18, 2009 i need 2 help in regex 1) i need to take all the text between <td class="object_desc" dir=rtl align=right valign=top background="iaasds/jxx05.gif" width="554" height="67" style="padding-right:20px;padding-left:35px;"> to </td> 2)i need to take all the text between <td width="100%" colspan="4" valign="top" align="right" dir=rtl><font face="Arial" size="2"> to </font> thank Quote Link to comment Share on other sites More sharing options...
effigy Posted January 19, 2009 Share Posted January 19, 2009 <pre> <?php $start = '<td class="object_desc" dir=rtl align=right valign=top background="iaasds/jxx05.gif" width="554" height="67" style="padding-right:20px;padding-left:35px;">'; $end = '</td>'; preg_match('/' . preg_quote($start) . '(.*?)' . preg_quote($end) . '/', $data, $matches); print_r($matches); ?> </pre> Quote Link to comment Share on other sites More sharing options...
yolop Posted January 19, 2009 Author Share Posted January 19, 2009 preg_match() [function.preg-match]: Unknown modifier '/' Quote Link to comment Share on other sites More sharing options...
effigy Posted January 19, 2009 Share Posted January 19, 2009 Apparently it requires the delimiter: preg_match('/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/', $data, $matches); Quote Link to comment Share on other sites More sharing options...
yolop Posted January 19, 2009 Author Share Posted January 19, 2009 array() =/ Quote Link to comment Share on other sites More sharing options...
.josh Posted January 20, 2009 Share Posted January 20, 2009 try this: preg_match('/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s', $data, $matches); Quote Link to comment Share on other sites More sharing options...
yolop Posted January 20, 2009 Author Share Posted January 20, 2009 i will try but that code need to work for all the regex?? 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.