- preg_replace: documentation ( source)
<?php
$text = 'qwe <a href="/asd/ghj/wer.html">123</a>, qwe <a href="http://www.arrivo.ru/asdwer.html">123</a>, qwe <a title="smth" href="//arrivo.ru/w/sd/ger.html">123</a>, qwe <a href=http://yandex.ru/index.html title="smth">123</a>, qwe <a href="/smth/else">123</a>, http://www.arrivo.ru/nooo.html :)';
$text = preg_replace('#<a (.+)((http:|https:)?//(www\.)?arrivo\.ru|/)/(.+)\.html(.+)>#isU', '<a $1$2/$5$6>', $text);
echo $text;