Forum Moderators: coopster

Message Too Old, No Replies

Regular Expression

         

compose

5:30 am on Oct 25, 2005 (gmt 0)

10+ Year Member



Hi,
I want to trape all rows containing <td> or <td height="15" etc... td attribute >.

$chars = preg_split('/<td.*>/i', $mystring); 
print_r($chars);

I am using this code but it is extracting only td's with attribute not normal <td>.

i think problem is of "." it is telling atleast one character after <td can any body tell me how to do this.

Vineet

coopster

4:17 pm on Oct 25, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes, make that "zero or more characters that is not a closing tag":
$chars = preg_split('/<td[^>]*>/i', $mystring);

compose

12:11 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



Thanx coopster,

it's really working.Thanx for ur instant help.

Vineet.