please see code :
$result = "<b>Associated Names</b> [<a href='http://www.examples.com/authors.html?act=change&id=6141&item=associated'><u>Edit</u></a>]</td>
</tr>
<tr>
<td class='text' align='left'>G・R<br />G-R<br /> </td>"
preg_match_all("/<b>Associated Names.{10,100}<td class='text' align='left'>((.*<br \/>)*).*<\/td>/sU", $result, $assoc);
var_dump($assoc);
-----------------------------------------------------------
RESULT
array
0 =>
array
0 => string '<b>Associated Names</b></td>
</tr>
<tr>
<td class='text' align='left'>G・R<br />G-R<br /> </td>' (length=135)
1 =>
array
0 => string '' (length=0)
2 =>
array
0 => string '' (length=0)
I want it return
array(
1 =>
array
0 => string 'G・R',
2 =>
array
0 => string> 'G-R'
)
it is a matter of parentheses ((.)) i want fix it, please help me
Please don’t try to parse HTML with regular expressions, it invokes the wrath of Zalgo.
Try using the DOM and xpath to target the specific elements and attributes you are attempting to extract.
(I’d provide an xpath example, but it’s still on my to-learn list… 🙂 )