monk.e.boy Posted April 24, 2007 Share Posted April 24, 2007 <tr> <th align="left" bgcolor="#FFFFFF"><font face="Arial" size="2">IP country:</font></th> <td bgcolor="#FFFFFF"> <font face="Arial" size="2"> <img src="/flags/gb.png"> United Kingdom </font> </td> </tr> How would I get "United Kingdom", there are lots of rows in the table (so lots of tr's), the row I want has "IP country:" in the previous TD. Hope that makes sense! ta! monk.e.boy Quote Link to comment Share on other sites More sharing options...
c4onastick Posted April 24, 2007 Share Posted April 24, 2007 Assuming that the font tags are the same for every instance you want this matched, you can use this: preg_match('%IP country:</font>.+>(.+?)</font>%s', $text, $matches); Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted April 24, 2007 Author Share Posted April 24, 2007 Ah! dot matches new line! Doh!! Why didn't I know about that?!? It makes everything so simple. I was trying [.\s]+? but that matches a '.' character. Thanks c4onastick! monk.e.boy Quote Link to comment Share on other sites More sharing options...
c4onastick Posted April 24, 2007 Share Posted April 24, 2007 No problem. But the dot only matches a newline when you use the 's' modifier. 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.