0

I have following text

        <h2>Subjects</h2>
        <ul>

        <li><a href='http://isbndb.com/subject/transfer_pricing'>
        Transfer pricing</a></li>

        <li><a   
        hef='http://isbndb.com/subject/intangible_property_valuation'>   
        Intangible property -- Valuation</a></li>


        </ul>

the numbers of <li> .. </li> could be variable. Can anyone tell me the regex to get

     Transfer pricing
     Intangible property -- Valuation

it might be done with preg_split, but I have no glue how the regex should be. Thanks a lot.

Walter Schrabmair
  • 1,251
  • 2
  • 13
  • 26

1 Answers1

2

Try some thing like this:

   $output = "<h2>Subjects</h2>
    <ul>

    <li><a href='http://isbndb.com/subject/transfer_pricing'>
    Transfer pricing</a></li>

    <li><a   
    hef='http://isbndb.com/subject/intangible_property_valuation'>   
    Intangible property -- Valuation</a></li>


    </ul>";

   preg_match_all("li><a href='(.[^>]*)>(.[^<]*)</",$output , $array_check);


        print_r($array_check);
kailash sharma
  • 356
  • 1
  • 12