Reputation: 787
I want to extract values from the code below.
<tbody>
<tr>
<td><div class="file_pdf"><a href="javascript:downloadFile('1628')">note1</a></div></td>
<td class="textright">110 KB</td>
<td class="textright">106</td>
</tr>
<tr>
<td><div class="file_pdf"><a href="javascript:downloadFile('1629')">note2.pdf</a></div></td>
<td class="textright">44 KB</td>
<td class="textright">104</td>
</tr>
</tbody>
I want to extract 'note1', 'note2' strings and 1628 and 1629 numbers.
i treid
preg_match_all('~(\'\)\">(.*?)<\/a>)~', $getinside, $matches);
but its result is not what I am looking for..
is there any simple RegEx to extract them? Thanks!
Upvotes: 0
Views: 41
Reputation: 39365
It should work for you:
preg_match_all("~downloadFile\('(\d+)'\)\">([^<]*)</a>~", $getinside, $matches);
Remember: If your html is very large/complex and you also need to parse more other things from there, then regex is not a better option to do this.
Upvotes: 1