Thursday 15 July 2010

php - Get a list of domains from a table via regex -


I have more information and

  & lt; Td> There is a list of domains in the table with example1. Com & lt; / TD & gt; & Lt; TD & gt; Example2.org & lt; / TD & gt; & Lt; TD & gt; Example3.com & lt; / TD & gt; & Lt; TD & gt; Example4.com & lt; / TD & gt;   

I need a .com domain by using a regex. I tried to do something like this:

  '& lt; Td> (.............). Com '  

But what can I write instead of dots? What do I need to use?

I need to get data between tags: & lt; Td> Domain.com & lt; / Td> - & gt; Domain.com

  '& lt; Td> ([^ & Lt;] + \ .com) & lt; / Td>   

- It is better, but I need to get it without tags

   Example 1.com & lt; / Td> & Lt; TD & gt; Example2.org & lt; / TD & gt; & Lt; TD & gt; Example3.com & lt; / TD & gt; & Lt; TD & gt; Example4.com & lt; / TD & gt; '; $ Matches = array (); Preg_match_all ('/ / lt; td & gt; (. * .com)  / i', $ html, $ matches); Var_dump ($ matches [1]);   

Print:

  array (3) {[0] => String (12) "example1.com" [1] = & gt; String (12) "Example 3.com" [2] = & gt; String (12) "example4.com"}    

No comments:

Post a Comment