$x = '<a href="https://www.r10.net">R10.Net</a>'; $x = preg_replace('~<a([^>]+>)([^<]+)</a>~', 'YAZI', $x);