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.
它可能是用preg_split完成的,但是我没有胶水应该如何正则表达式。非常感谢。
1 个解决方案
#1
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);
#1
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);