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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted March 7, 2008 Author Share Posted March 7, 2008 you are right. I miss that. 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.