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 Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/ 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> Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/#findComment-740422 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 '/' Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/#findComment-740599 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); Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/#findComment-740602 Share on other sites More sharing options...
yolop Posted January 19, 2009 Author Share Posted January 19, 2009 array() =/ Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/#findComment-740770 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); Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/#findComment-740824 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?? Link to comment https://forums.phpfreaks.com/topic/141315-hi-2-help-with-regex/#findComment-741068 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.