This seems to work:
PHP Code:
<?php
$content = '
<a href="asd.php">asd</a>
<a href="asd.html" target="_blank">asd</a>
<a href="asd2.php">asd</a>
<a href="asd2.html" target="_blank">asd</a>';
// Start of open tag
$regex = '~<a href="';
// Match a url
$regex .= '(.*?)"';
// Match any attributes
$regex .= '([a-zA-Z0-9\=\-\"\s]*)';
// Match target="_blank"
$regex .= ' ?target="_blank" ?';
// Any attributes again
$regex .= '([a-zA-Z0-9\=\-\"\s]*)';
// End of open tag
$regex .= '>~i';
preg_match_all($regex, $content, $matches);
print_r($matches[1]);
Bookmarks