How to take name in one preg_match

Posted by Julianto on Stack Overflow See other posts from Stack Overflow or by Julianto
Published on 2010-04-16T08:15:29Z Indexed on 2010/04/16 8:23 UTC
Read the original article Hit count: 279

Filed under:
|
|

Hello guys,

I am trying to extract just the names result from the hypothetical HTML file below.

<ul class="cat">
<li>sport</li>
<li>movie</li>
</ul>
<ul class="person-list">
<li>name 1</li>
<li>name 2</li>
<li>name 3</li>
<li>name 4</li>
<li>name 5</li>
<li>name 6</li>
</ul>

Ideally, the result should come in an array format like the one below: Array( name 1 , name 2 , name 3 , .......... )

OK I can easily do this with 2 regex matches but I was wondering if I can do it with just one.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about regularexpressions

Related posts about regex