Reputation: 567
I'm trying to find preg match_all for the ISBN for this lines:
<td itemprop="isbn">9789953278544</td></tr>
<td itemprop="isbn">9789953278535</td></tr>
<td itemprop="isbn">9789953278568</td></tr>
I've tried:
preg_match_all('|<td itemprop="isbn">(.+?)"</td></tr>|si', '<td itemprop="isbn">9789953278544</td></tr><td itemprop="isbn">9789953278535</td></tr><td itemprop="isbn">9789953278568</td></tr>', $tags, PREG_SET_ORDER);
echo $connect[1][0];
foreach ($tags as $tag) {
echo $tag[1] . "<br>";
}
Upvotes: 1
Views: 67
Reputation: 3238
try with this search pattern .
My code
<?php
preg_match_all('/<td itemprop="isbn">(.+?)<\/td><\/tr>/', '<td itemprop="isbn">9789953278544</td></tr><td itemprop="isbn">9789953278535</td></tr><td itemprop="isbn">9789953278568</td></tr>', $tags, PREG_SET_ORDER);
foreach ($tags as $tag) {
echo $tag[1] . "<br>";
}
?>
output
9789953278544<br>9789953278535<br>9789953278568<br>
Upvotes: 2