Forum Moderators: coopster
The following syntax does not identify linebreaks:
preg_match("/\<td[^\>]*\>.*\[P0\].*\<\/td\>/", $str, $match);
The following syntax matches since the first TD tag in the document:
preg_match("/\<td[^\>]*\>.*\[P0\].*\<\/td\>/s", $str, $match);
How cai I acomplish it?
The following script is the TD tag I want to match. It was gererated by Excel, and I have to match the entire TD tag.
[codes]
<td width=316 valign=top style='width:236.95pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt'>
<p class=MsoNormal><span lang=PT-BR style='font-family:Arial;color:#000000'>[P0]</span><span
style='font-size:10.0pt;mso-ansi-language:EN-US;mso-fareast-language:EN-US'><o:p></o:p></span></p>
</td>
[/codes]
Did you try the multiline modifier? Not sure if PHP supports it, but I think it does.
preg_match("/\<td[^\>]*\>.*\[P0\].*\<\/td\>/m", $str, $match);
If all else fails you could convert it to a string with no line breaks before trying to match on it. MS output ugh . . . good luck.