ainoy31 Posted March 6, 2008 Share Posted March 6, 2008 Hello- I need help with my script. I am trying to get the date out of the following html. <tr> $data = ' <td align="right" style="font-weight: bold; font-size: 10pt; height: 21px"> <span id="FormView1_Label2" style="display:inline-block;"><font face="Microsoft Sans Serif,Tahoma,Courier New" color="#000040" size="1">Pickup Date:</font></span></td> <td align="left" style="font-weight: normal; font-size: 10pt; height: 18px"> <span id="FormView1_pickup_dtLabel" style="display:inline-block;"><font face="Microsoft Sans Serif,Tahoma,Courier New" color="#000040" size="1">3/4/2008</font></span></td>'; Here is my code that I am trying. foreach(explode("\n",$data) as $line) { if(stristr($line, 'Pickup Date:')) { preg_match_all('#(Pickup Date):.*?(\d{1,2}/\d{1,2}/\d{4})#is', $line, $matches, PREG_SET_ORDER); } } If I do a print_r(matches), the array is empty. Much appreciation. AM Link to comment https://forums.phpfreaks.com/topic/94752-regex-script/ Share on other sites More sharing options...
fnairb Posted March 6, 2008 Share Posted March 6, 2008 I can't tell for sure but it appears that the date and 'Pickup Date:' are on different lines. If that is the case since you are checking one line at a time your regexp will never match. Link to comment https://forums.phpfreaks.com/topic/94752-regex-script/#findComment-485321 Share on other sites More sharing options...
ainoy31 Posted March 7, 2008 Author Share Posted March 7, 2008 you are right. I miss that. Link to comment https://forums.phpfreaks.com/topic/94752-regex-script/#findComment-486311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.