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 href="//arrivo.ru/w/sd/ger.html">123</a>, qwe <a href="http://yandex.ru/index.html">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/$3$4', $text); echo $text;

preferences:
56.79 ms | 402 KiB | 5 Q