Jump to content

regex script ?


ainoy31

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.