Example:
Access – <a href="http://extratorrent.cc/search/?search=Cotent">Torrent Search</a> – <a href="http://link1.com/Text">Link 1</a> – <a href="http://link2.com/Text">Link 2</a> – <a href="http://link3.com/Text">Link 3</a> – <a href="http://link4.com/Text">Link 4</a>
I want use regex to make it like this
Access – <a href="http://extratorrent.cc/search/?search=Cotent">Torrent Search</a> – AAABBBCCC
I just know </?a(|\s+[^>]+)>
to remove url link but don't know how to regex like content above.
Something like this?
<?php
$input = 'Access – <a href="http://extratorrent.cc/search/?search=Cotent">Torrent Search</a> – <a href="http://link1.com/Text">Link 1</a> – <a href="http://link2.com/Text">Link 2</a> – <a href="http://link3.com/Text">Link 3</a> – <a href="http://link4.com/Text">Link 4</a>';
$output = preg_replace("/<a href=\"http:\/\/(?!extratorrent.cc)[^\"]+\">([^<]+)<\/a>/", '$1', $input);
// remove all links
$output = preg_replace("/\ –? Link [0-9]+/", '', $output);
// CONCAT TEXT
$output.= " AABBCCDD";
echo $output;
/*
output:
Access – <a href="http://extratorrent.cc/search/?search=Cotent">Torrent Search</a> AABBCCDD
*/