3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
42.38 ms | 402 KiB | 5 Q