I have something like this
Code: Select all
str_replace("\n<font style=\x22font-size: ??px;\x22><a href=\x22http://www.domain.com/search.php?query=\x22></a></font></br> ", "", etc...THX
Moderator: General Moderators
Code: Select all
str_replace("\n<font style=\x22font-size: ??px;\x22><a href=\x22http://www.domain.com/search.php?query=\x22></a></font></br> ", "", etc...Thanks for you answer, but I could not find a solution yet. I have tried different regex 'solutions', but it's not easy.marcth wrote:Use a regular expression.
Code: Select all
<font style="font-size: 20px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>
<font style="font-size: 17px;"><a href="http://www.domain.com/search.php?query="></a></font></br>
<font style="font-size: 17px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>
<font style="font-size: 20px;"><a href="http://www.domain.com/search.php?query="></a></font></br>
<font style="font-size: 16px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>
<font style="font-size: 30px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>
<font style="font-size: 14px;"><a href="http://www.domain.com/search.php?query="></a></font></br>
<font style="font-size: 10px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>
<font style="font-size: 28px;"><a href="http://www.domain.com/search.php?query="></a></font></br>
Code: Select all
<?php
$page = "/home/website/domains/domain.com/public_html/outputdata.txt";
$nodups = array_unique (explode ("\n", str_replace("\n<font style=\x22font-size: 15px;\x22><a href=\x22http://www.domain.com/search.php?query=\x22></a></font></br> ", "", file_get_contents($page))));
echo implode("\n",array_slice($nodups,-101,100));
?>Code: Select all
$input = array(
'<font style="font-size: 20px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 17px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
'<font style="font-size: 17px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 20px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
'<font style="font-size: 16px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 30px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 14px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
'<font style="font-size: 10px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 28px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
);
$output = array();
foreach($input as $value) {
preg_match('/<a href=.*<\/a>/', $value, $results);
$output = array_merge($output, $results);
}
print '<pre>';
print_r($output);
print '</pre>';
Code: Select all
$input = array(
'<font style="font-size: 20px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 17px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
'<font style="font-size: 17px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 20px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
'<font style="font-size: 16px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 30px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 14px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
'<font style="font-size: 10px;"><a href="http://www.domain.com/search.php?query=keyword">keyword</a></font></br>',
'<font style="font-size: 28px;"><a href="http://www.domain.com/search.php?query="></a></font></br>',
);
$output = array();
foreach($input as $value) {
$output[] = preg_replace('/d{2}/si',$yourfontsize,$value);
}